diff --git a/checkin_notes b/checkin_notes index 42db054aef..11c51c0875 100755 --- a/checkin_notes +++ b/checkin_notes @@ -10366,4 +10366,23 @@ Walt 20 Sept 2006 older client that doesn't support . clientgui/ - ViewWork.cpp \ No newline at end of file + ViewWork.cpp + +Charlie 21 Sept 2006 + - Mac: Set PROCINFO user_time to cpu time from ps command; use rsz + instead of rss for working_set_size; set page_fault_count to + pagein value from ps command. Unfortunately, none of these + selectors work correctly in OS X version of ps command: pagein, + majflt and minflt. + - Mac: modify release script to include these files in distribution: + switcher/switcher, switcher/setprojectgrp, Mac_SA_Secure.sh and + Mac_SA_Insecure.sh. + - Mac: improvements to Mac_SA_Secure.sh, Mac_SA_Insecure.sh scripts. + + lib/ + procinfo_mac.C + mac_installer/ + release_boinc.sh + mac_build/ + Mac_SA_Insecure.sh + Mac_SA_Secure.sh diff --git a/lib/procinfo_mac.C b/lib/procinfo_mac.C index 72bee0a507..6e47d8dba6 100644 --- a/lib/procinfo_mac.C +++ b/lib/procinfo_mac.C @@ -37,7 +37,7 @@ int procinfo_setup(vector& pi) { FILE* fd; PROCINFO p; - int c, real_mem, virtual_mem; + int c, real_mem, virtual_mem, hours; // Some values of possible interest available from 'ps' command: // %cpu percentage cpu usage (alias pcpu) @@ -45,6 +45,7 @@ int procinfo_setup(vector& pi) { // majflt total page faults // minflt total page reclaims // nswap total swaps in/out +// pagein pageins (same as majflt) // pid process ID // ppid parent process ID // poip pageouts in progress @@ -53,9 +54,7 @@ int procinfo_setup(vector& pi) { // time accumulated cpu time, user + system // vsz virtual size in Kbytes - memset(&p, 0, sizeof(p)); - - fd = popen("ps -axopid,ppid,rss,vsz", "r"); + fd = popen("ps -axopid,ppid,rsz,vsz,pagein,time", "r"); if (!fd) return 0; // Skip over the header line @@ -68,13 +67,14 @@ int procinfo_setup(vector& pi) { } while (c != '\n'); while (1) { - c = fscanf(fd, "%5d%6d%6d%9d\n", &p.id, &p.parentid, &real_mem, &virtual_mem); - if (c < 4) break; + memset(&p, 0, sizeof(p)); + c = fscanf(fd, "%d%d%d%d%ld%d:%lf\n", &p.id, &p.parentid, &real_mem, &virtual_mem, &p.page_fault_count, &hours, &p.user_time); + if (c < 7) break; p.working_set_size = (double)real_mem * 1024.; p.swap_size = (double)virtual_mem * 1024.; + p.user_time += 60. * (float)hours; p.is_boinc_app = false; pi.push_back(p); - } pclose(fd); @@ -95,7 +95,7 @@ void add_child_totals(PROCINFO& pi, vector& piv, int pid, int rlvl) { PROCINFO& p = piv[i]; if (p.parentid == pid) { // pi.kernel_time += p.kernel_time; -// pi.user_time += p.user_time; + pi.user_time += p.user_time; pi.swap_size += p.swap_size; pi.working_set_size += p.working_set_size; p.is_boinc_app = true; @@ -115,7 +115,7 @@ void procinfo_app(PROCINFO& pi, vector& piv) { PROCINFO& p = piv[i]; if (p.id == pi.id) { // pi.kernel_time += p.kernel_time; -// pi.user_time += p.user_time; + pi.user_time += p.user_time; pi.swap_size += p.swap_size; pi.working_set_size += p.working_set_size; p.is_boinc_app = true; @@ -134,7 +134,7 @@ void procinfo_other(PROCINFO& pi, vector& piv) { PROCINFO& p = piv[i]; if (!p.is_boinc_app) { // pi.kernel_time += p.kernel_time; -// pi.user_time += p.user_time; + pi.user_time += p.user_time; pi.swap_size += p.swap_size; pi.working_set_size += p.working_set_size; p.is_boinc_app = true; diff --git a/mac_build/Mac_SA_Insecure.sh b/mac_build/Mac_SA_Insecure.sh index 67096aac4a..253a99fc00 100755 --- a/mac_build/Mac_SA_Insecure.sh +++ b/mac_build/Mac_SA_Insecure.sh @@ -22,7 +22,6 @@ # Mac_SA_Insecure.sh user group # # Undo making a Macintosh BOINC installation secure. -# This script is for Macintosh installations with stand-alone BOINC CLient (i.e., no BOINC Manager.) # - Set file/dir ownership to the specified user and group # - Remove BOINC groups and users # @@ -30,13 +29,32 @@ # cd {path_to_boinc_directory} # sudo sh {path}/Mac_SA_Insecure.sh user group # +# After running this script, the boinc client must be run with +# the --insecure option. +# NOTE: running BOINC with security disabled is not recommended. +# +# Last updated 9/21/06 function remove_boinc_users() { -sudo dscl . -delete /users/boinc_master -sudo dscl . -delete /groups/boinc_master + name=$(dscl . search /users RecordName boinc_master | cut -f1 -) + if [ "$name" = "boinc_master" ] ; then + sudo dscl . -delete /users/boinc_master + fi -sudo dscl . -delete /users/boinc_project -sudo dscl . -delete /groups/boinc_project + name=$(dscl . search /groups RecordName boinc_master | cut -f1 -) + if [ "$name" = "boinc_master" ] ; then + sudo dscl . -delete /groups/boinc_master + fi + + name=$(dscl . search /users RecordName boinc_project | cut -f1 -) + if [ "$name" = "boinc_project" ] ; then + sudo dscl . -delete /users/boinc_project + fi + + name=$(dscl . search /groups RecordName boinc_project | cut -f1 -) + if [ "$name" = "boinc_project" ] ; then + sudo dscl . -delete /groups/boinc_project + fi } function check_login() { @@ -65,7 +83,7 @@ then exit fi -if [ ! -x "boinc" ] +if [ ! -f "boinc" ] then echo "Can't find boinc Client in directory $(pwd); exiting" exit diff --git a/mac_build/Mac_SA_Secure.sh b/mac_build/Mac_SA_Secure.sh index 10e823daf8..e11522f578 100755 --- a/mac_build/Mac_SA_Secure.sh +++ b/mac_build/Mac_SA_Secure.sh @@ -21,7 +21,10 @@ # Make a BOINC installation "secure" on a Macintosh with stand-alone BOINC Client # The BOINC installer does this for a Macintosh installation with BOINC Manager; -# do not use this script. +# the BOINC Manager contains the BOINC client embedded in its bundle. +# if you ran the BOINC installer, you do not need to use this script unless you +# wish to run a separate copy of the stand-alone client in the BOINC Data +# directory. # # Create groups and users, set file/dir ownership and protection # @@ -32,8 +35,9 @@ # Hint: you can enter the path to a directory or file by dragging its # icon from the Finder onto the Terminal window. # -# You must have already run the installer script -# that creates the switcher/ and locale/ directories, and their contents +# You must have already put all necessary files into the boinc directory, +# including the boinc client, boinc_cmd application, ca-bundle.crt, plus +# the switcher/ directory and its contents. # # This script also assumes that the user who runs it will be authorized # to administer BOINC. For convenience in administering BOINC, this script @@ -50,6 +54,8 @@ # sudo dscl . -delete /groups/boinc_master users mary # +# Last updated 9/21/06 + function make_boinc_user() { # Check whether group already exists name=$(dscl . search /groups RecordName $1 | cut -f1 -) @@ -153,9 +159,9 @@ then exit fi -if [ ! -f "boinc" ] +if [ ! -x "switcher/switcher" ] then - echo "Can't find boinc Client in directory $(pwd); exiting" + echo "Can't find switcher application in directory $(pwd); exiting" exit fi @@ -186,10 +192,17 @@ set_perm switcher/switcher boinc_project boinc_project 6551 set_perm switcher/setprojectgrp boinc_master boinc_project 2500 set_perm switcher boinc_master boinc_master 0550 -set_perm_recursive locale boinc_master boinc_master u+r-w,g+r-w,o-rwx +if [ -d locale ] ; then + set_perm_recursive locale boinc_master boinc_master u+r-w,g+r-w,o-rwx +fi -set_perm boinc boinc_master boinc_master 6555 # boinc client +if [ -f boinc ] ; then + set_perm boinc boinc_master boinc_master 6555 # boinc client +fi +if [ -f boinc_cmd ] ; then + set_perm boinc_cmd boinc_master boinc_master 0550 +fi if [ -x /Applications/BOINCManager.app/Contents/MacOS/BOINCManager ] ; then set_perm /Applications/BOINCManager.app/Contents/MacOS/BOINCManager boinc_master boinc_master 2555 diff --git a/mac_installer/release_boinc.sh b/mac_installer/release_boinc.sh index 2d0f7eac61..11a3b0ebc1 100644 --- a/mac_installer/release_boinc.sh +++ b/mac_installer/release_boinc.sh @@ -20,7 +20,7 @@ ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -# Release Script for Macintosh BOINC Manager 2/16/06 by Charlie Fenton +# Release Script for Macintosh BOINC Manager 9/21/06 by Charlie Fenton ## ## Usage: @@ -128,14 +128,6 @@ cp -fp ../BOINC_Installer/Installer\ Resources/ReadMe.rtf ../BOINC_Installer/New sudo chown -R 501:admin ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_universal/ReadMe.rtf sudo chmod -R 644 ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_universal/ReadMe.rtf -cp -fpR $BUILDPATH/boinc ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/ -cp -fpR $BUILDPATH/boinc_cmd ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/ -cp -fpR curl/ca-bundle.crt ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/ -sudo chown -R root:admin ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/* -sudo chmod -R u+rw-s,g+r-ws,o+r-w ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/* - -cp -fpR $BUILDPATH/SymbolTables ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_SymbolTables/ - # Copy the installer wrapper application "BOINC Installer.app" cp -fpR $BUILDPATH/BOINC\ Installer.app ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_universal/ # Build the installer package inside the wrapper application's bundle @@ -143,6 +135,24 @@ cp -fpR $BUILDPATH/BOINC\ Installer.app ../BOINC_Installer/New_Release_$1_$2_$3/ # Allow the installer wrapper application to modify the package's Info.plist file sudo chmod u+w,g+w,o+w ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_universal/BOINC\ Installer.app/Contents/Resources/BOINC.pkg/Contents/Info.plist +# Build the stand-alone client distribution +cp -fpR mac_build/Mac_SA_Insecure.sh ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/ +cp -fpR mac_build/Mac_SA_Secure.sh ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/ + +mkdir -p ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/move_to_boinc_dir +cp -fpR $BUILDPATH/boinc ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/move_to_boinc_dir/ +cp -fpR $BUILDPATH/boinc_cmd ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/move_to_boinc_dir/ +cp -fpR curl/ca-bundle.crt ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/move_to_boinc_dir/ + +mkdir -p ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/move_to_boinc_dir/switcher +cp -fpR $BUILDPATH/switcher ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/move_to_boinc_dir/switcher/ +cp -fpR $BUILDPATH/setprojectgrp ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/move_to_boinc_dir/switcher/ + +sudo chown -R root:admin ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/* +sudo chmod -R u+rw-s,g+r-ws,o+r-w ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_universal-apple-darwin/* + +cp -fpR $BUILDPATH/SymbolTables ../BOINC_Installer/New_Release_$1_$2_$3/boinc_$1.$2.$3_macOSX_SymbolTables/ + cd ../BOINC_Installer/New_Release_$1_$2_$3 zip -rqy boinc_$1.$2.$3_macOSX_universal.zip boinc_$1.$2.$3_macOSX_universal zip -rqy boinc_$1.$2.$3_universal-apple-darwin.zip boinc_$1.$2.$3_universal-apple-darwin