mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
* sysdeps/unix/sysv/linux/cmsg_nxthdr.c (__cmsg_nxthdr): Correct test for cmsg struct size. * sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): Likewise. * sysdeps/unix/sysv/linux/i386/makecontext.S: Remove unnecessary initializations. * libio/oldiopopen.c: Add lock for old_proc_file_chain access.
This commit is contained in:
@ -1,6 +1,14 @@
|
|||||||
2001-07-31 Ulrich Drepper <drepper@redhat.com>
|
2001-07-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/cmsg_nxthdr.c (__cmsg_nxthdr): Correct
|
||||||
|
test for cmsg struct size.
|
||||||
|
* sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): Likewise.
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/i386/makecontext.S: Remove unnecessary
|
||||||
|
initializations.
|
||||||
|
|
||||||
* libio/iopopen.c: Add lock for proc_file_chain access.
|
* libio/iopopen.c: Add lock for proc_file_chain access.
|
||||||
|
* libio/oldiopopen.c: Add lock for old_proc_file_chain access.
|
||||||
Reported by Padraig Brady <Padraig@linux.ie>.
|
Reported by Padraig Brady <Padraig@linux.ie>.
|
||||||
|
|
||||||
2001-07-31 Andreas Jaeger <aj@suse.de>
|
2001-07-31 Andreas Jaeger <aj@suse.de>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1998,99,2000 Free Software Foundation, Inc.
|
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Written by Per Bothner <bothner@cygnus.com>.
|
Written by Per Bothner <bothner@cygnus.com>.
|
||||||
|
|
||||||
@ -109,6 +109,16 @@ typedef struct _IO_proc_file _IO_proc_file;
|
|||||||
|
|
||||||
static struct _IO_proc_file *old_proc_file_chain;
|
static struct _IO_proc_file *old_proc_file_chain;
|
||||||
|
|
||||||
|
#ifdef _IO_MTSAFE_IO
|
||||||
|
static _IO_lock_t proc_file_chain_lock = _IO_lock_initializer;
|
||||||
|
|
||||||
|
static void
|
||||||
|
unlock (void *not_used)
|
||||||
|
{
|
||||||
|
_IO_lock_unlock (proc_file_chain_lock);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_IO_FILE *
|
_IO_FILE *
|
||||||
_IO_old_proc_open (fp, command, mode)
|
_IO_old_proc_open (fp, command, mode)
|
||||||
_IO_FILE *fp;
|
_IO_FILE *fp;
|
||||||
@ -173,8 +183,16 @@ _IO_old_proc_open (fp, command, mode)
|
|||||||
_IO_fileno (fp) = parent_end;
|
_IO_fileno (fp) = parent_end;
|
||||||
|
|
||||||
/* Link into old_proc_file_chain. */
|
/* Link into old_proc_file_chain. */
|
||||||
|
#ifdef _IO_MTSFE_IO
|
||||||
|
_IO_cleanup_region_start_noarg (unlock);
|
||||||
|
_IO_lock_lock (proc_file_chain_lock);
|
||||||
|
#endif
|
||||||
((_IO_proc_file *) fp)->next = old_proc_file_chain;
|
((_IO_proc_file *) fp)->next = old_proc_file_chain;
|
||||||
old_proc_file_chain = (_IO_proc_file *) fp;
|
old_proc_file_chain = (_IO_proc_file *) fp;
|
||||||
|
#ifdef _IO_MTSFE_IO
|
||||||
|
_IO_lock_unlock (proc_file_chain_lock);
|
||||||
|
_IO_cleanup_region_end (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
_IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES);
|
_IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES);
|
||||||
return fp;
|
return fp;
|
||||||
@ -229,6 +247,10 @@ _IO_old_proc_close (fp)
|
|||||||
int status = -1;
|
int status = -1;
|
||||||
|
|
||||||
/* Unlink from old_proc_file_chain. */
|
/* Unlink from old_proc_file_chain. */
|
||||||
|
#ifdef _IO_MTSFE_IO
|
||||||
|
_IO_cleanup_region_start_noarg (unlock);
|
||||||
|
_IO_lock_lock (proc_file_chain_lock);
|
||||||
|
#endif
|
||||||
for ( ; *ptr != NULL; ptr = &(*ptr)->next)
|
for ( ; *ptr != NULL; ptr = &(*ptr)->next)
|
||||||
{
|
{
|
||||||
if (*ptr == (_IO_proc_file *) fp)
|
if (*ptr == (_IO_proc_file *) fp)
|
||||||
@ -238,6 +260,10 @@ _IO_old_proc_close (fp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef _IO_MTSFE_IO
|
||||||
|
_IO_lock_unlock (proc_file_chain_lock);
|
||||||
|
_IO_cleanup_region_end (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (status < 0 || _IO_close (_IO_fileno(fp)) < 0)
|
if (status < 0 || _IO_close (_IO_fileno(fp)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-07-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* Examples/ex17.c: Make sure test thread is around long enough.
|
||||||
|
|
||||||
2001-07-26 kaz Kojima <kkojima@rr.iij4u.or.jp>
|
2001-07-26 kaz Kojima <kkojima@rr.iij4u.or.jp>
|
||||||
|
|
||||||
* sysdeps/sh/pt-machine.h (THREAD_SELF, INIT_THREAD_SELF): Defined.
|
* sysdeps/sh/pt-machine.h (THREAD_SELF, INIT_THREAD_SELF): Defined.
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
static pthread_mutex_t synch = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
test_thread (void *v_param)
|
test_thread (void *v_param)
|
||||||
{
|
{
|
||||||
|
pthread_mutex_lock (&synch);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +59,13 @@ main (void)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status = pthread_mutex_lock (&synch);
|
||||||
|
if (status != 0)
|
||||||
|
{
|
||||||
|
printf ("cannot get lock: %s\n", strerror (status));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
status = pthread_create (&thread, &attr, test_thread, NULL);
|
status = pthread_create (&thread, &attr, test_thread, NULL);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
{
|
{
|
||||||
@ -85,6 +95,13 @@ main (void)
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status = pthread_mutex_unlock (&synch);
|
||||||
|
if (status != 0)
|
||||||
|
{
|
||||||
|
printf ("cannot release lock: %s\n", strerror (status));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* pthread_detach (thread); */
|
/* pthread_detach (thread); */
|
||||||
if (pthread_join (thread, NULL) != 0)
|
if (pthread_join (thread, NULL) != 0)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,12 @@ threadfct (void *arg)
|
|||||||
{
|
{
|
||||||
int n = (int) (long int) arg;
|
int n = (int) (long int) arg;
|
||||||
|
|
||||||
|
if (getcontext (&ctx[n][1]) != 0)
|
||||||
|
{
|
||||||
|
printf ("%d: cannot get context: %m\n", n);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
printf ("%d: %s: before makecontext\n", n, __FUNCTION__);
|
printf ("%d: %s: before makecontext\n", n, __FUNCTION__);
|
||||||
|
|
||||||
ctx[n][1].uc_stack.ss_sp = stacks[n];
|
ctx[n][1].uc_stack.ss_sp = stacks[n];
|
||||||
|
@ -268,8 +268,8 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
|
|||||||
|
|
||||||
__cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
|
__cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
|
||||||
+ CMSG_ALIGN (__cmsg->cmsg_len));
|
+ CMSG_ALIGN (__cmsg->cmsg_len));
|
||||||
if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
|
if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
|
||||||
+ __mhdr->msg_controllen)
|
+ __mhdr->msg_controllen)
|
||||||
|| ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
|
|| ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
|
||||||
> ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
|
> ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
|
||||||
/* No more entries. */
|
/* No more entries. */
|
||||||
|
@ -29,8 +29,8 @@ __cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg)
|
|||||||
|
|
||||||
cmsg = (struct cmsghdr *) ((unsigned char *) cmsg
|
cmsg = (struct cmsghdr *) ((unsigned char *) cmsg
|
||||||
+ CMSG_ALIGN (cmsg->cmsg_len));
|
+ CMSG_ALIGN (cmsg->cmsg_len));
|
||||||
if ((unsigned char *) (cmsg + 1) >= ((unsigned char *) mhdr->msg_control
|
if ((unsigned char *) (cmsg + 1) > ((unsigned char *) mhdr->msg_control
|
||||||
+ mhdr->msg_controllen)
|
+ mhdr->msg_controllen)
|
||||||
|| ((unsigned char *) cmsg + CMSG_ALIGN (cmsg->cmsg_len)
|
|| ((unsigned char *) cmsg + CMSG_ALIGN (cmsg->cmsg_len)
|
||||||
> ((unsigned char *) mhdr->msg_control + mhdr->msg_controllen)))
|
> ((unsigned char *) mhdr->msg_control + mhdr->msg_controllen)))
|
||||||
/* No more entries. */
|
/* No more entries. */
|
||||||
|
@ -40,22 +40,6 @@ ENTRY(__makecontext)
|
|||||||
movl oLINK(%eax), %ecx
|
movl oLINK(%eax), %ecx
|
||||||
movl %ecx, -4(%edx)
|
movl %ecx, -4(%edx)
|
||||||
|
|
||||||
/* Copy the FS and GS segment register. */
|
|
||||||
xorl %ecx, %ecx
|
|
||||||
movw %gs, %cx
|
|
||||||
movl %ecx, oGS(%eax)
|
|
||||||
xorl %ecx, %ecx
|
|
||||||
movw %fs, %cx
|
|
||||||
movl %ecx, oFS(%eax)
|
|
||||||
|
|
||||||
/* We have separate floating-point register content memory on the
|
|
||||||
stack. We use the __fpregs_mem block in the context. Set the
|
|
||||||
links up correctly. */
|
|
||||||
leal oFPREGSMEM(%eax), %ecx
|
|
||||||
movl %ecx, oFPREGS(%eax)
|
|
||||||
/* Save the floating-point context. */
|
|
||||||
fnstenv (%ecx)
|
|
||||||
|
|
||||||
/* Remember the number of parameters for the exit handler since
|
/* Remember the number of parameters for the exit handler since
|
||||||
it has to remove them. We store the number in the EBX register
|
it has to remove them. We store the number in the EBX register
|
||||||
which the function we will call must preserve. */
|
which the function we will call must preserve. */
|
||||||
|
Reference in New Issue
Block a user