siginterrupt.c (1574) | siginterrupt.c (17141) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 27 unchanged lines hidden (view full) --- 36#endif /* LIBC_SCCS and not lint */ 37 38#include <signal.h> 39 40/* 41 * Set signal state to prevent restart of system calls 42 * after an instance of the indicated signal. 43 */ | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 27 unchanged lines hidden (view full) --- 36#endif /* LIBC_SCCS and not lint */ 37 38#include <signal.h> 39 40/* 41 * Set signal state to prevent restart of system calls 42 * after an instance of the indicated signal. 43 */ |
44int |
|
44siginterrupt(sig, flag) 45 int sig, flag; 46{ 47 extern sigset_t _sigintr; 48 struct sigaction sa; 49 int ret; 50 51 if ((ret = sigaction(sig, (struct sigaction *)0, &sa)) < 0) 52 return (ret); 53 if (flag) { 54 sigaddset(&_sigintr, sig); 55 sa.sa_flags &= ~SA_RESTART; 56 } else { 57 sigdelset(&_sigintr, sig); 58 sa.sa_flags |= SA_RESTART; 59 } 60 return (sigaction(sig, &sa, (struct sigaction *)0)); 61} | 45siginterrupt(sig, flag) 46 int sig, flag; 47{ 48 extern sigset_t _sigintr; 49 struct sigaction sa; 50 int ret; 51 52 if ((ret = sigaction(sig, (struct sigaction *)0, &sa)) < 0) 53 return (ret); 54 if (flag) { 55 sigaddset(&_sigintr, sig); 56 sa.sa_flags &= ~SA_RESTART; 57 } else { 58 sigdelset(&_sigintr, sig); 59 sa.sa_flags |= SA_RESTART; 60 } 61 return (sigaction(sig, &sa, (struct sigaction *)0)); 62} |