View | Details | Raw Unified | Return to bug 120233
Collapse All | Expand All

(-)sys/sys/fcntl.h (+1 lines)
Lines 176-181 Link Here
176
#define	F_GETLK		7		/* get record locking information */
176
#define	F_GETLK		7		/* get record locking information */
177
#define	F_SETLK		8		/* set record locking information */
177
#define	F_SETLK		8		/* set record locking information */
178
#define	F_SETLKW	9		/* F_SETLK; wait if blocked */
178
#define	F_SETLKW	9		/* F_SETLK; wait if blocked */
179
#define	F_DUP2FD	10		/* duplicate file descriptor, fixed */
179
180
180
/* file descriptor flags (F_GETFD, F_SETFD) */
181
/* file descriptor flags (F_GETFD, F_SETFD) */
181
#define	FD_CLOEXEC	1		/* close-on-exec flag */
182
#define	FD_CLOEXEC	1		/* close-on-exec flag */
(-)sys/kern/kern_descrip.c (+16 lines)
Lines 365-370 Link Here
365
	 */
365
	 */
366
	switch (cmd) {
366
	switch (cmd) {
367
	case F_DUPFD:
367
	case F_DUPFD:
368
	case F_DUP2FD:
368
	case F_GETFD:
369
	case F_GETFD:
369
	case F_SETFD:
370
	case F_SETFD:
370
	case F_GETFL:
371
	case F_GETFL:
Lines 405-410 Link Here
405
		error = do_dup(td, DUP_VARIABLE, fd, newmin, td->td_retval);
406
		error = do_dup(td, DUP_VARIABLE, fd, newmin, td->td_retval);
406
		break;
407
		break;
407
408
409
	case F_DUP2FD:
410
		/* mtx_assert(&Giant, MA_NOTOWNED); */
411
		FILEDESC_UNLOCK(fdp);
412
		newmin = arg;
413
		PROC_LOCK(p);
414
		if (newmin >= lim_cur(p, RLIMIT_NOFILE) ||
415
		    newmin >= maxfilesperproc) {
416
			PROC_UNLOCK(p);
417
			error = EINVAL;
418
			break;
419
		}
420
		PROC_UNLOCK(p);
421
		error = do_dup(td, DUP_FIXED, fd, newmin, td->td_retval);
422
		break;
423
408
	case F_GETFD:
424
	case F_GETFD:
409
		/* mtx_assert(&Giant, MA_NOTOWNED); */
425
		/* mtx_assert(&Giant, MA_NOTOWNED); */
410
		td->td_retval[0] = (*pop & UF_EXCLOSE) ? FD_CLOEXEC : 0;
426
		td->td_retval[0] = (*pop & UF_EXCLOSE) ? FD_CLOEXEC : 0;

Return to bug 120233