diff options
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt | 2 | ||||
-rw-r--r-- | usr/src/cmd/dlmgmtd/svc-dlmgmtd | 4 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/reparsed/reparsed.c | 9 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/smbclnt/chacl/chacl.c | 9 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/smbclnt/umount/umount.c | 6 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/ufs/mkfs/mkfs.c | 5 | ||||
-rw-r--r-- | usr/src/cmd/nscd/svc-nscd | 40 | ||||
-rw-r--r-- | usr/src/cmd/svc/shell/smf_include.sh | 5 | ||||
-rw-r--r-- | usr/src/cmd/svc/startd/method.c | 12 |
9 files changed, 58 insertions, 34 deletions
diff --git a/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt b/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt index d5812793d4..6b39cde11f 100644 --- a/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt +++ b/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt @@ -30,7 +30,7 @@ . /lib/svc/share/smf_include.sh if [ -z "$SMF_FMRI" ]; then - echo "this script can only be invoked by smf(5)" + echo "this script can only be invoked by smf(5)" exit $SMF_EXIT_ERR_NOSMF fi diff --git a/usr/src/cmd/dlmgmtd/svc-dlmgmtd b/usr/src/cmd/dlmgmtd/svc-dlmgmtd index a75e71f9b3..af59ba7fa6 100644 --- a/usr/src/cmd/dlmgmtd/svc-dlmgmtd +++ b/usr/src/cmd/dlmgmtd/svc-dlmgmtd @@ -32,7 +32,9 @@ # an empty contract. if smf_is_nonglobalzone; then - exit $SMF_EXIT_NODAEMON + [ -n "$SMF_EXIT_NODAEMON" ] && exit $SMF_EXIT_NODAEMON + (while true ; do sleep 3600 ; done) & + exit $SMF_EXIT_OK fi # Start the dlmgmtd daemon. diff --git a/usr/src/cmd/fs.d/reparsed/reparsed.c b/usr/src/cmd/fs.d/reparsed/reparsed.c index 17027b0c78..0b1532dc40 100644 --- a/usr/src/cmd/fs.d/reparsed/reparsed.c +++ b/usr/src/cmd/fs.d/reparsed/reparsed.c @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + +/* * Reparsed daemon */ @@ -191,10 +195,11 @@ reparsed_door_call_error(int error, int buflen) memset(&rpd_res, 0, sizeof (reparsed_door_res_t)); rpd_res.res_status = error; rpd_res.res_len = buflen; - door_return((char *)&rpd_res, sizeof (reparsed_door_res_t), NULL, 0); + (void) door_return((char *)&rpd_res, + sizeof (reparsed_door_res_t), NULL, 0); (void) door_return(NULL, 0, NULL, 0); - /* NOTREACHED */ + abort(); } /* diff --git a/usr/src/cmd/fs.d/smbclnt/chacl/chacl.c b/usr/src/cmd/fs.d/smbclnt/chacl/chacl.c index 4b5f8722df..413c8a62fa 100644 --- a/usr/src/cmd/fs.d/smbclnt/chacl/chacl.c +++ b/usr/src/cmd/fs.d/smbclnt/chacl/chacl.c @@ -25,6 +25,10 @@ */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + +/* * This is the smbfs/chacl command. * (just for testing - not installed) * @@ -138,9 +142,8 @@ main(int argc, char **argv) /* * Which parts of the SD are being modified? */ - selector = 0; - if (acl) - selector |= DACL_SECURITY_INFORMATION; + selector = DACL_SECURITY_INFORMATION; + if (uid != (uid_t)-1) selector |= OWNER_SECURITY_INFORMATION; if (gid != (gid_t)-1) diff --git a/usr/src/cmd/fs.d/smbclnt/umount/umount.c b/usr/src/cmd/fs.d/smbclnt/umount/umount.c index 5bf6984e78..412557e567 100644 --- a/usr/src/cmd/fs.d/smbclnt/umount/umount.c +++ b/usr/src/cmd/fs.d/smbclnt/umount/umount.c @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + +/* * smbfs umount */ @@ -179,6 +183,6 @@ mnttab_find(dirname) } } - fclose(fp); + (void) fclose(fp); return (res); } diff --git a/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c b/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c index 6b5439d47c..0098b56082 100644 --- a/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c +++ b/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c @@ -37,6 +37,10 @@ */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + +/* * The maximum supported file system size (in sectors) is the * number of frags that can be represented in an int32_t field * (INT_MAX) times the maximum number of sectors per frag. Since @@ -235,6 +239,7 @@ #include <sys/int_const.h> #include <signal.h> #include <sys/efi_partition.h> +#include <fslib.h> #include "roll_log.h" #define bcopy(f, t, n) (void) memcpy(t, f, n) diff --git a/usr/src/cmd/nscd/svc-nscd b/usr/src/cmd/nscd/svc-nscd index 78b318bf87..c9f23f7088 100644 --- a/usr/src/cmd/nscd/svc-nscd +++ b/usr/src/cmd/nscd/svc-nscd @@ -34,34 +34,36 @@ if (smf_is_system_labeled); then if (smf_is_nonglobalzone); then if [ ! -f /var/tsol/doors/nscd_per_label ]; then - # If needed create a door to the global zone daemon. - if [ -r /var/run/name_service_door ]; then + # If needed create a door to the global zone daemon. + if [ -r /var/run/name_service_door ]; then rm /var/run/name_service_door - fi - ln -s /var/tsol/doors/name_service_door \ + fi + ln -s /var/tsol/doors/name_service_door \ /var/run || exit $SMF_EXIT_ERR_FATAL - # If current service duration is not "transient", - # create a dummy background process to preserve + # If current service duration is not "transient", + # create a dummy background process to preserve # contract lifetime. - duration="" - if /bin/svcprop -q -c -p startd/duration $SMF_FMRI + duration="" + if /bin/svcprop -q -c -p startd/duration $SMF_FMRI then - duration=`/bin/svcprop -c -p startd/duration \ + duration=`/bin/svcprop -c -p startd/duration \ $SMF_FMRI` - fi - if [ "$duration" != "transient" ]; then - exit $SMF_EXIT_NODAEMON - fi + fi + if [ "$duration" != "transient" ]; then + [ -n "$SMF_EXIT_NODAEMON" ] && \ + exit $SMF_EXIT_NODAEMON + (while true ; do sleep 3600 ; done) & + fi - # The real daemon is not started in non-global zones, + # The real daemon is not started in non-global zones, # so exit now. - exit $SMF_EXIT_OK + exit $SMF_EXIT_OK else - # remove the door to the global zone daemon - if [ -L /var/run/name_service_door ]; then - rm /var/run/name_service_door - fi + # remove the door to the global zone daemon + if [ -L /var/run/name_service_door ]; then + rm /var/run/name_service_door + fi fi fi fi diff --git a/usr/src/cmd/svc/shell/smf_include.sh b/usr/src/cmd/svc/shell/smf_include.sh index 429e3310f4..a5e3431d5b 100644 --- a/usr/src/cmd/svc/shell/smf_include.sh +++ b/usr/src/cmd/svc/shell/smf_include.sh @@ -24,6 +24,7 @@ # Use is subject to license terms. # Copyright 2012 Joyent, Inc. All rights reserved. # Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# Copyright 2012 Joyent, Inc. All rights reserved. # smf_present () { @@ -155,7 +156,7 @@ smf_netstrategy () { # # Example, send SIGTERM to contract 200: # -# smf_kill_contract 200 TERM +# smf_kill_contract 200 TERM # # Since killing a contract with pkill(1) is not atomic, # smf_kill_contract will continue to send SIGNAL to CONTRACT @@ -202,7 +203,7 @@ smf_kill_contract() { # Return if WAIT is not set or is "0" [ -z "$3" ] && return 0 [ "$3" -eq 0 ] && return 0 - + # If contract does not empty, keep killing the contract to catch # any child processes missed because they were forking /usr/bin/pgrep -c $1 > /dev/null 2>&1 diff --git a/usr/src/cmd/svc/startd/method.c b/usr/src/cmd/svc/startd/method.c index 1d8ffaa2b6..915ad42da6 100644 --- a/usr/src/cmd/svc/startd/method.c +++ b/usr/src/cmd/svc/startd/method.c @@ -698,7 +698,7 @@ method_run(restarter_inst_t **instp, int type, int *exit_code) if (inst->ri_mi_deleted) return (ECANCELED); - *exit_code = 0; + *exit_code = SMF_EXIT_OK; assert(0 <= type && type <= 2); mname = method_names[type]; @@ -1034,7 +1034,8 @@ method_run(restarter_inst_t **instp, int type, int *exit_code) } *exit_code = WEXITSTATUS(ret_status); - if (*exit_code != 0 && *exit_code != SMF_EXIT_NODAEMON) { + if (*exit_code != SMF_EXIT_OK && + *exit_code != SMF_EXIT_NODAEMON) { log_error(LOG_WARNING, "%s: Method \"%s\" failed with exit status %d.\n", inst->ri_i.i_fmri, method, WEXITSTATUS(ret_status)); @@ -1044,7 +1045,7 @@ method_run(restarter_inst_t **instp, int type, int *exit_code) "%d.", mname, *exit_code); /* Note: we will take this path for SMF_EXIT_NODAEMON */ - if (*exit_code != 0) + if (*exit_code != SMF_EXIT_OK) goto contract_out; end_time = time(NULL); @@ -1095,7 +1096,7 @@ contract_out: * SMF_EXIT_NODAEMON & methods that fail. */ transient = method_is_transient(inst, type); - if ((transient || *exit_code != 0 || result != 0) && + if ((transient || *exit_code != SMF_EXIT_OK || result != 0) && (restarter_is_kill_method(method) < 0)) method_remove_contract(inst, !transient, B_TRUE); @@ -1191,7 +1192,8 @@ retry: r = method_run(&inst, info->sf_method_type, &exit_code); - if (r == 0 && (exit_code == 0 || exit_code == SMF_EXIT_NODAEMON)) { + if (r == 0 && + (exit_code == SMF_EXIT_OK || exit_code == SMF_EXIT_NODAEMON)) { /* Success! */ assert(inst->ri_i.i_next_state != RESTARTER_STATE_NONE); |