TCP-IP




UNIX - 3


37 for ( i = 0; i < rlim.rlim_max; i++ )

38 close( i );

39 endif

40 i = open( "/dev/null", 0_RDWR );

41 f ( i < 0 )

42 return -1;

43 up2( i, 0 ) ;

44 up2( i, 1 };

45 up2( i, 2 );

46 f ( i > 2 )

47 close( i ) ;

48 }

49 return 0;

50 }

signal

, UNIX s ignal . ­ sigaction. , signal sigaction ( 1.3)

1.3. signal

signal. c

/* signal - SVR4 . */

1 typedef void sighndlr_t( int );

2 sighndlr_t *signal( int sig, sighndlr_t *hndlr )

3 {

4 struct sigaction act;

5 struct sigaction xact;

6 act.sa_handler = hndlr;

7 act.sa_flags =0;

8 sigemptyset( &act.sa_mask );

9 if ( sigaction( sig, &act, &xact ) < 0 )

10 return SIG_ERR;

11 return xact.sa_handler;

12 }

| | |