Check-in [316b02041a]
Overview
Comment:Updated to check return value of waitpid()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 316b02041ae664c31ecaf387eacb4264cd852e3b
User & Date: rkeene on 2012-09-15 06:44:19
Other Links: manifest | tags
Context
2012-09-15
06:48
Updated to check return value of chdir() check-in: 99eb340549 user: rkeene tags: trunk
06:44
Updated to check return value of waitpid() check-in: 316b02041a user: rkeene tags: trunk
2012-09-09
21:25
Corrected example in test.tcl check-in: 2c31ced898 user: rkeene tags: trunk
Changes

Modified initrd/admin-tclkit/kitcreator-modules/system/system.c from [1d6aabc455] to [7ecfb38f87].

1879
1880
1881
1882
1883
1884
1885
1886

1887
1888
1889
1890
1891
1892
1893
1879
1880
1881
1882
1883
1884
1885

1886
1887
1888
1889
1890
1891
1892
1893







-
+







}

static int tclsystem_tsmf_start_svc(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	struct timeval select_timeout;
	Tcl_WideInt umask_val, timeout_val;
	Tcl_Obj *filename_obj, *env_obj, *logfile_obj, **env_entry_objv, *cwd_obj, *umask_obj, *user_obj, *group_obj;
	Tcl_Obj *sri_obj, *timeout_obj;
	pid_t child, child_pgid = -1;
	pid_t child, child_pgid = -1, waitpid_ret;
	ssize_t read_ret;
	time_t currtime;
	char *argv[3], *envv[512];
	char *logfile, *filename, *cwd, *user, *group;
	char logmsg[2048];
	fd_set read_fdset;
	int pipe_ret, setsid_ret, execve_ret, tcl_ret, select_ret;
2079
2080
2081
2082
2083
2084
2085
2086




2087
2088
2089
2090
2091
2092
2093
2079
2080
2081
2082
2083
2084
2085

2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096







-
+
+
+
+







		write(fd, &child_pgid, sizeof(child_pgid));

		_exit(0);
	}

	if (child != 0) {
		/* 7.parent.a. Wait for child process to terminate and collect status */
		waitpid(child, &status, 0);
		waitpid_ret = waitpid(child, &status, 0);
		if (waitpid_ret == ((pid_t) -1)) {
			status = -1;
		}

		/* 7.parent.b. Set PGID (if successful, -1 otherwise) to pass back to TSMF */
		if (status == 0) {
			child_pgid = getpgid(getpid());
		}
		write(fd, &child_pgid, sizeof(child_pgid));