Deleted Added
full compact
sysv_msg.c (164033) sysv_msg.c (164368)
1/*-
2 * Implementation of SVID messages
3 *
4 * Author: Daniel Boulet
5 *
6 * Copyright 1993 Daniel Boulet and RTMX Inc.
7 *
8 * This system call was implemented by Daniel Boulet under contract from RTMX.

--- 34 unchanged lines hidden (view full) ---

43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 */
49
50#include <sys/cdefs.h>
1/*-
2 * Implementation of SVID messages
3 *
4 * Author: Daniel Boulet
5 *
6 * Copyright 1993 Daniel Boulet and RTMX Inc.
7 *
8 * This system call was implemented by Daniel Boulet under contract from RTMX.

--- 34 unchanged lines hidden (view full) ---

43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 */
49
50#include <sys/cdefs.h>
51__FBSDID("$FreeBSD: head/sys/kern/sysv_msg.c 164033 2006-11-06 13:42:10Z rwatson $");
51__FBSDID("$FreeBSD: head/sys/kern/sysv_msg.c 164368 2006-11-17 20:43:01Z jkim $");
52
53#include "opt_sysvipc.h"
54#include "opt_mac.h"
55
56#include <sys/param.h>
57#include <sys/systm.h>
58#include <sys/sysproto.h>
59#include <sys/kernel.h>

--- 715 unchanged lines hidden (view full) ---

775 we_own_it = 0;
776 } else {
777 /* Force later arrivals to wait for our
778 request */
779 DPRINTF(("we own the msqid_ds\n"));
780 msqkptr->u.msg_perm.mode |= MSG_LOCKED;
781 we_own_it = 1;
782 }
52
53#include "opt_sysvipc.h"
54#include "opt_mac.h"
55
56#include <sys/param.h>
57#include <sys/systm.h>
58#include <sys/sysproto.h>
59#include <sys/kernel.h>

--- 715 unchanged lines hidden (view full) ---

775 we_own_it = 0;
776 } else {
777 /* Force later arrivals to wait for our
778 request */
779 DPRINTF(("we own the msqid_ds\n"));
780 msqkptr->u.msg_perm.mode |= MSG_LOCKED;
781 we_own_it = 1;
782 }
783 DPRINTF(("goodnight\n"));
783 DPRINTF(("msgsnd: goodnight\n"));
784 error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH,
784 error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH,
785 "msgwait", 0);
786 DPRINTF(("good morning, error=%d\n", error));
785 "msgsnd", hz);
786 DPRINTF(("msgsnd: good morning, error=%d\n", error));
787 if (we_own_it)
788 msqkptr->u.msg_perm.mode &= ~MSG_LOCKED;
787 if (we_own_it)
788 msqkptr->u.msg_perm.mode &= ~MSG_LOCKED;
789 if (error == EWOULDBLOCK) {
790 DPRINTF(("msgsnd: timed out\n"));
791 continue;
792 }
789 if (error != 0) {
790 DPRINTF(("msgsnd: interrupted system call\n"));
791 error = EINTR;
792 goto done2;
793 }
794
795 /*
796 * Make sure that the msq queue still exists

--- 376 unchanged lines hidden (view full) ---

1173 }
1174
1175 /*
1176 * Wait for something to happen
1177 */
1178
1179 DPRINTF(("msgrcv: goodnight\n"));
1180 error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH,
793 if (error != 0) {
794 DPRINTF(("msgsnd: interrupted system call\n"));
795 error = EINTR;
796 goto done2;
797 }
798
799 /*
800 * Make sure that the msq queue still exists

--- 376 unchanged lines hidden (view full) ---

1177 }
1178
1179 /*
1180 * Wait for something to happen
1181 */
1182
1183 DPRINTF(("msgrcv: goodnight\n"));
1184 error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH,
1181 "msgwait", 0);
1185 "msgrcv", 0);
1182 DPRINTF(("msgrcv: good morning (error=%d)\n", error));
1183
1184 if (error != 0) {
1186 DPRINTF(("msgrcv: good morning (error=%d)\n", error));
1187
1188 if (error != 0) {
1185 DPRINTF(("msgsnd: interrupted system call\n"));
1189 DPRINTF(("msgrcv: interrupted system call\n"));
1186 error = EINTR;
1187 goto done2;
1188 }
1189
1190 /*
1191 * Make sure that the msq queue still exists
1192 */
1193

--- 111 unchanged lines hidden ---
1190 error = EINTR;
1191 goto done2;
1192 }
1193
1194 /*
1195 * Make sure that the msq queue still exists
1196 */
1197

--- 111 unchanged lines hidden ---