Ticket #20862: screen-4.0.3-snowleopard.patch
File screen-4.0.3-snowleopard.patch, 11.0 KB (added by mccune.jeff@…, 15 years ago) |
---|
-
Makefile.in
diff --git a/Makefile.in b/Makefile.in index db683ac..14ba5db 100644
a b install_bin: .version screen 79 79 -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi 80 80 rm -f $(DESTDIR)$(bindir)/screen 81 81 (cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen) 82 cp $(srcdir)/utf8encodings/?? $(D ESTDIR)$(SCREENENCODINGS)82 cp $(srcdir)/utf8encodings/?? $(DSTROOT)$(SCREENENCODINGS) 83 83 84 84 ############################################################################### 85 85 install: installdirs install_bin … … install: installdirs install_bin 95 95 96 96 installdirs: 97 97 # Path leading to ETCSCREENRC and Socketdirectory not checked. 98 $(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(D ESTDIR)$(SCREENENCODINGS)98 $(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DSTROOT)$(SCREENENCODINGS) 99 99 cd doc ; $(MAKE) installdirs 100 100 101 101 uninstall: .version … … tty.c: tty.sh 122 122 sh $(srcdir)/tty.sh tty.c 123 123 124 124 comm.h: comm.c comm.sh config.h 125 AWK=$(AWK) CC="$(CC) $(CFLAGS)"srcdir=${srcdir} sh $(srcdir)/comm.sh125 AWK=$(AWK) srcdir=${srcdir} sh $(srcdir)/comm.sh 126 126 127 127 osdef.h: osdef.sh config.h osdef.h.in 128 128 CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh -
config.h.in
diff --git a/config.h.in b/config.h.in index 4327855..a32d66b 100644
a b 208 208 * If screen is installed with permissions to update /etc/utmp (such 209 209 * as if it is installed set-uid root), define UTMPOK. 210 210 */ 211 # defineUTMPOK211 #undef UTMPOK 212 212 213 213 /* Set LOGINDEFAULT to one (1) 214 214 * if you want entries added to /etc/utmp by default, else set it to 215 215 * zero (0). 216 216 * LOGINDEFAULT will be one (1) whenever LOGOUTOK is undefined! 217 217 */ 218 # define LOGINDEFAULT 1218 #undef LOGINDEFAULT 219 219 220 220 /* Set LOGOUTOK to one (1) 221 221 * if you want the user to be able to log her/his windows out. … … 231 231 * Set CAREFULUTMP to one (1) if you want that users have at least one 232 232 * window per screen session logged in. 233 233 */ 234 # define LOGOUTOK 1234 #undef LOGOUTOK 235 235 #undef CAREFULUTMP 236 236 237 237 -
configure
diff --git a/configure b/configure index 75675fc..c9dcbd3 100755
a b cat >>conftest.$ac_ext <<_ACEOF 5572 5572 5573 5573 #include <time.h> /* to get time_t on SCO */ 5574 5574 #include <sys/types.h> 5575 #if defined(SVR4) && !defined(DGUX)5575 #if (defined(SVR4) || defined(__APPLE__)) && !defined(DGUX) 5576 5576 #include <utmpx.h> 5577 5577 #define utmp utmpx 5578 5578 #else … … cat >>conftest.$ac_ext <<_ACEOF 5581 5581 #ifdef __hpux 5582 5582 #define pututline _pututline 5583 5583 #endif 5584 #ifdef __APPLE__ 5585 #define pututline pututxline 5586 #define getutent getutxent 5587 #endif 5584 5588 5585 5589 int 5586 5590 main () -
process.c
diff --git a/process.c b/process.c index 7f1a6e1..8e52b02 100644
a b char *data; /* dummy */ 5466 5466 *buf = 0; 5467 5467 return; 5468 5468 } 5469 act.nr = (int) data;5469 act.nr = (int)(intptr_t)data; 5470 5470 act.args = noargs; 5471 5471 act.argl = 0; 5472 5472 DoAction(&act, -1); -
pty.c
diff --git a/pty.c b/pty.c index f89d44c..38e9709 100644
a b 34 34 #endif 35 35 36 36 /* for solaris 2.1, Unixware (SVR4.2) and possibly others */ 37 #if def HAVE_SVR4_PTYS37 #if defined(HAVE_SVR4_PTYS) && !defined(__APPLE__) 38 38 # include <sys/stropts.h> 39 39 #endif 40 40 -
screen.c
diff --git a/screen.c b/screen.c index 70741df..c980514 100644
a b 101 101 102 102 #include "logfile.h" /* islogfile, logfflush */ 103 103 104 #ifdef __APPLE__ 105 #include <vproc.h> 106 #include <vproc_priv.h> 107 #endif 108 104 109 #ifdef DEBUG 105 110 FILE *dfp; 106 111 #endif … … char **av; 929 934 Panic(0, "No $SCREENDIR with multi screens, please."); 930 935 #endif 931 936 } 937 #ifdef __APPLE__ 938 else if (!multi && real_uid == eff_uid) { 939 static char DarwinSockDir[PATH_MAX]; 940 if (confstr(_CS_DARWIN_USER_TEMP_DIR, DarwinSockDir, sizeof(DarwinSockDir))) { 941 strlcat(DarwinSockDir, ".screen", sizeof(DarwinSockDir)); 942 SockDir = DarwinSockDir; 943 } 944 } 945 #endif /* __APPLE__ */ 946 932 947 #ifdef MULTIUSER 933 948 if (multiattach) 934 949 { … … char **av; 1211 1226 freopen("/dev/null", "w", stderr); 1212 1227 debug("-- screen.back debug started\n"); 1213 1228 1229 #ifdef __APPLE__ 1230 if (_vprocmgr_detach_from_console(0) != NULL) 1231 errx(1, "can't detach from console"); 1232 #endif 1233 1214 1234 /* 1215 1235 * This guarantees that the session owner is listed, even when we 1216 1236 * start detached. From now on we should not refer to 'LoginName' -
new file vproc_priv.h
diff --git a/vproc_priv.h b/vproc_priv.h new file mode 100644 index 0000000..b691c22
- + 1 #ifndef _VPROC_PRIVATE_H_ 2 #define _VPROC_PRIVATE_H_ 3 /* 4 * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. 5 * 6 * @APPLE_APACHE_LICENSE_HEADER_START@ 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 * 20 * @APPLE_APACHE_LICENSE_HEADER_END@ 21 */ 22 23 #include <Availability.h> 24 #include <sys/types.h> 25 #include <sys/cdefs.h> 26 #include <sys/syslog.h> 27 #include <sys/time.h> 28 #include <stdbool.h> 29 #include <launch.h> 30 #include <vproc.h> 31 #include <uuid/uuid.h> 32 33 #ifndef VPROC_HAS_TRANSACTIONS 34 #define VPROC_HAS_TRANSACTIONS 35 #endif 36 37 __BEGIN_DECLS 38 39 #pragma GCC visibility push(default) 40 41 /* DO NOT use this. This is a hack for 'launchctl' */ 42 #define VPROC_MAGIC_UNLOAD_SIGNAL 0x4141504C 43 /* DO NOT use this. This is a hack for 'loginwindow' */ 44 #define VPROC_MAGIC_TRYKILL_SIGNAL 0x6161706C 45 46 typedef enum { 47 VPROC_GSK_LAST_EXIT_STATUS = 1, 48 VPROC_GSK_GLOBAL_ON_DEMAND, 49 VPROC_GSK_MGR_UID, 50 VPROC_GSK_MGR_PID, 51 VPROC_GSK_IS_MANAGED, 52 VPROC_GSK_MGR_NAME, 53 VPROC_GSK_BASIC_KEEPALIVE, 54 VPROC_GSK_START_INTERVAL, 55 VPROC_GSK_IDLE_TIMEOUT, 56 VPROC_GSK_EXIT_TIMEOUT, 57 VPROC_GSK_ENVIRONMENT, 58 VPROC_GSK_ALLJOBS, 59 VPROC_GSK_GLOBAL_LOG_MASK, 60 VPROC_GSK_GLOBAL_UMASK, 61 VPROC_GSK_ABANDON_PROCESS_GROUP, 62 VPROC_GSK_TRANSACTIONS_ENABLED, 63 VPROC_GSK_WEIRD_BOOTSTRAP, 64 VPROC_GSK_WAITFORDEBUGGER, 65 VPROC_GSK_SECURITYSESSION, 66 VPROC_GSK_SHUTDOWN_DEBUGGING, 67 VPROC_GSK_VERBOSE_BOOT, 68 VPROC_GSK_PERUSER_SUSPEND, 69 VPROC_GSK_PERUSER_RESUME, 70 VPROC_GSK_JOB_OVERRIDES_DB, 71 VPROC_GSK_JOB_CACHE_DB, 72 VPROC_GSK_EMBEDDEDROOTEQUIVALENT, 73 } vproc_gsk_t; 74 75 typedef unsigned int vproc_flags_t; 76 /* For _vproc_kickstart_by_label() -- instructs launchd to kickstart the job to stall before exec(2). */ 77 #define VPROCFLAG_STALL_JOB_EXEC 1 << 1 78 79 vproc_t vprocmgr_lookup_vproc(const char *label); 80 vproc_t vproc_retain(vproc_t vp); 81 void vproc_release(vproc_t vp); 82 83 vproc_err_t vproc_swap_integer(vproc_t vp, vproc_gsk_t key, int64_t *inval, int64_t *outval); 84 vproc_err_t vproc_swap_complex(vproc_t vp, vproc_gsk_t key, launch_data_t inval, launch_data_t *outval); 85 vproc_err_t vproc_swap_string(vproc_t vp, vproc_gsk_t key, const char *instr, char **outstr); 86 87 vproc_err_t _vproc_get_last_exit_status(int *wstatus); 88 vproc_err_t _vproc_set_global_on_demand(bool val); 89 90 typedef void (*_vprocmgr_log_drain_callback_t)(struct timeval *when, pid_t from_pid, pid_t about_pid, uid_t sender_uid, gid_t sender_gid, int priority, const char *from_name, const char *about_name, const char *session_name, const char *msg); 91 92 vproc_err_t _vprocmgr_log_drain(vproc_t vp, pthread_mutex_t *optional_mutex_around_callback, _vprocmgr_log_drain_callback_t func); 93 94 vproc_err_t _vproc_send_signal_by_label(const char *label, int sig); 95 vproc_err_t _vproc_kickstart_by_label(const char *label, pid_t *out_pid, mach_port_t *out_port_name, mach_port_t *out_obsrvr_port, vproc_flags_t flags); 96 vproc_err_t _vproc_wait_by_label(const char *label, int *out_wstatus); 97 98 void _vproc_log(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3))); 99 void _vproc_log_error(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3))); 100 void _vproc_logv(int pri, int err, const char *msg, va_list ap) __attribute__((format(printf, 3, 0))); 101 102 #define VPROCMGR_SESSION_LOGINWINDOW "LoginWindow" 103 #define VPROCMGR_SESSION_BACKGROUND "Background" 104 #define VPROCMGR_SESSION_AQUA "Aqua" 105 #define VPROCMGR_SESSION_STANDARDIO "StandardIO" 106 #define VPROCMGR_SESSION_SYSTEM "System" 107 108 vproc_err_t _vprocmgr_move_subset_to_user(uid_t target_user, const char *session_type, uint64_t flags); 109 vproc_err_t _vprocmgr_switch_to_session(const char *target_session, vproc_flags_t flags); 110 vproc_err_t _vprocmgr_detach_from_console(vproc_flags_t flags); 111 112 void _vproc_standby_begin(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 113 void _vproc_standby_end(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 114 size_t _vproc_standby_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 115 size_t _vproc_standby_timeout(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 116 117 kern_return_t _vproc_transaction_count_for_pid(pid_t p, int32_t *count, bool *condemned) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 118 bool _vproc_pid_is_managed(pid_t p) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 119 void _vproc_transaction_try_exit(int status) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 120 void _vproc_transaction_begin(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 121 void _vproc_transaction_end(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 122 size_t _vproc_transaction_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); 123 124 #pragma GCC visibility pop 125 126 __END_DECLS 127 128 #endif -
window.c
diff --git a/window.c b/window.c index 3b60ae0..5cae839 100644
a b 25 25 #include <sys/stat.h> 26 26 #include <signal.h> 27 27 #include <fcntl.h> 28 #include <unistd.h> 28 29 #ifndef sun 29 30 # include <sys/ioctl.h> 30 31 #endif … … char **args, *ttyn; 1387 1388 return pid; 1388 1389 } 1389 1390 1391 #ifdef RUN_LOGIN 1392 /* 1393 * All of the logic to maintain utmpx is now built into /usr/bin/login, so 1394 * all we need to do is call it, and pass the shell command to it. 1395 */ 1396 extern char *LoginName; 1397 1398 static int 1399 run_login(const char *path, char *const argv[], char *const envp[]) 1400 { 1401 const char *shargs[MAXARGS + 1 + 3]; 1402 const char **fp, **tp; 1403 1404 if (access(path, X_OK) < 0) 1405 return -1; 1406 shargs[0] = "login"; 1407 shargs[1] = (*argv[0] == '-') ? "-pfq" : "-pflq"; 1408 shargs[2] = LoginName; 1409 shargs[3] = path; 1410 fp = (const char **)argv + 1; 1411 tp = shargs + 4; 1412 /* argv has already been check for length */ 1413 while ((*tp++ = *fp++) != NULL) {} 1414 /* shouldn't return unless there was an error */ 1415 return (execve("/usr/bin/login", (char *const*)shargs, envp)); 1416 } 1417 1418 /* replace the following occurrences of execve() with run_login() */ 1419 #define execve run_login 1420 1421 #endif /* RUN_LOGIN */ 1422 1390 1423 void 1391 1424 execvpe(prog, args, env) 1392 1425 char *prog, **args, **env;