tty_pts.c (8f0ea33f2bbf3a6aa80235f0a02fa5f2780c2b17) | tty_pts.c (90f54cbfeb973c0e2ee7b617b7759ac4335a9efe) |
---|---|
1/*- 2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Portions of this software were developed under sponsorship from Snow 6 * B.V., the Netherlands. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 831 unchanged lines hidden (view full) --- 840 841 error = falloc(td, &fp, &fd, uap->flags); 842 if (error) 843 return (error); 844 845 /* Allocate the actual pseudo-TTY. */ 846 error = pts_alloc(FFLAGS(uap->flags & O_ACCMODE), td, fp); 847 if (error != 0) { | 1/*- 2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Portions of this software were developed under sponsorship from Snow 6 * B.V., the Netherlands. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 831 unchanged lines hidden (view full) --- 840 841 error = falloc(td, &fp, &fd, uap->flags); 842 if (error) 843 return (error); 844 845 /* Allocate the actual pseudo-TTY. */ 846 error = pts_alloc(FFLAGS(uap->flags & O_ACCMODE), td, fp); 847 if (error != 0) { |
848 fdclose(td->td_proc->p_fd, fp, fd, td); | 848 fdclose(td, fp, fd); |
849 fdrop(fp, td); 850 return (error); 851 } 852 853 /* Pass it back to userspace. */ 854 td->td_retval[0] = fd; 855 fdrop(fp, td); 856 857 return (0); 858} 859 860static void 861pts_init(void *unused) 862{ 863 864 pts_pool = new_unrhdr(0, INT_MAX, NULL); 865} 866 867SYSINIT(pts, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pts_init, NULL); | 849 fdrop(fp, td); 850 return (error); 851 } 852 853 /* Pass it back to userspace. */ 854 td->td_retval[0] = fd; 855 fdrop(fp, td); 856 857 return (0); 858} 859 860static void 861pts_init(void *unused) 862{ 863 864 pts_pool = new_unrhdr(0, INT_MAX, NULL); 865} 866 867SYSINIT(pts, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pts_init, NULL); |