* [RFC] [PATCH 01/13] Change pid accesses: drivers
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 02/13] Change pid accesses: most archs Serge E. Hallyn
` (15 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B0-change-pid-tgid-references-drivers --]
[-- Type: text/plain, Size: 41460 bytes --]
Replace-Subject: Change pid accesses: drivers
From: Serge Hallyn <serue@us.ibm.com>
Instead of letting all parts of the kernel have direct access to
tsk->pid and tgid, make them use a accessor functions: task_{p,tg}id().
This will need to be done for a few other fields, but I decided to start
with those two. Note that pid has been renamed __pid to make sure that
any uncaught users will error out.
Note that this is very similar to what the vserver vx_map_pid() does,
and doing something like this should shrink their patch.
Our next patchset can find all the places where a pid crosses the
user<->kernel boundary, and do the correct conversions. Perhaps some
sparse annotations will allow us to do this more automatically, instead
of auditing everything. We could have a concept of __user for pids, not
just pointers.
This first patch changes the pid accesses under drivers/.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
drivers/acorn/block/fd1772.c | 2 +-
drivers/acpi/osl.c | 2 +-
drivers/block/ataflop.c | 2 +-
drivers/block/nbd.c | 2 +-
drivers/cdrom/cdrom.c | 2 +-
drivers/cdrom/mcdx.c | 2 +-
drivers/cdrom/sbpcd.c | 4 ++--
drivers/char/agp/frontend.c | 6 +++---
drivers/char/cyclades.c | 10 +++++-----
drivers/char/drm/drm_bufs.c | 2 +-
drivers/char/drm/drm_drv.c | 2 +-
drivers/char/drm/drm_fops.c | 8 ++++----
drivers/char/drm/drm_lock.c | 6 +++---
drivers/char/drm/drm_os_linux.h | 2 +-
drivers/char/drm/drm_vm.c | 2 +-
drivers/char/drm/i810_dma.c | 2 +-
drivers/char/drm/i830_dma.c | 2 +-
drivers/char/n_r3964.c | 12 ++++++------
drivers/char/random.c | 2 +-
drivers/char/rio/linux_compat.h | 2 +-
drivers/char/snsc_event.c | 2 +-
drivers/char/sx.c | 2 +-
drivers/char/sysrq.c | 2 +-
drivers/char/tty_io.c | 6 +++---
drivers/char/vt_ioctl.c | 4 ++--
drivers/input/joystick/iforce/iforce-main.c | 8 ++++----
drivers/input/joystick/iforce/iforce.h | 4 ++--
drivers/macintosh/adb.c | 8 ++++----
drivers/md/bitmap.c | 4 ++--
drivers/md/md.c | 6 +++---
drivers/media/video/zoran_driver.c | 4 ++--
drivers/net/slip.c | 6 +++---
drivers/net/tun.c | 2 +-
drivers/net/wireless/hostap/hostap_ioctl.c | 2 +-
drivers/oprofile/buffer_sync.c | 4 ++--
drivers/s390/char/fs3270.c | 2 +-
drivers/s390/crypto/z90main.c | 4 ++--
drivers/s390/s390mach.c | 2 +-
drivers/scsi/53c7xx.c | 2 +-
drivers/scsi/dc395x.c | 4 ++--
drivers/scsi/eata_pio.c | 2 +-
drivers/serial/crisv10.c | 4 ++--
drivers/usb/core/devio.c | 6 +++---
drivers/usb/input/hid-lgff.c | 8 ++++----
drivers/usb/input/hid-tmff.c | 8 ++++----
drivers/usb/input/pid.c | 8 ++++----
46 files changed, 94 insertions(+), 94 deletions(-)
Index: linux-2.6.15-rc1/drivers/acorn/block/fd1772.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/acorn/block/fd1772.c
+++ linux-2.6.15-rc1/drivers/acorn/block/fd1772.c
@@ -1275,7 +1275,7 @@ static void do_fd_request(request_queue_
{
unsigned long flags;
- DPRINT(("do_fd_request for pid %d\n", current->pid));
+ DPRINT(("do_fd_request for pid %d\n", task_pid(current)));
if (fdc_busy) return;
save_flags(flags);
cli();
Index: linux-2.6.15-rc1/drivers/acpi/osl.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/acpi/osl.c
+++ linux-2.6.15-rc1/drivers/acpi/osl.c
@@ -931,7 +931,7 @@ u8 acpi_os_writable(void *ptr, acpi_size
u32 acpi_os_get_thread_id(void)
{
if (!in_atomic())
- return current->pid;
+ return task_pid(current);
return 0;
}
Index: linux-2.6.15-rc1/drivers/block/ataflop.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/block/ataflop.c
+++ linux-2.6.15-rc1/drivers/block/ataflop.c
@@ -1470,7 +1470,7 @@ void do_fd_request(request_queue_t * q)
{
unsigned long flags;
- DPRINT(("do_fd_request for pid %d\n",current->pid));
+ DPRINT(("do_fd_request for pid %d\n",task_pid(current)));
while( fdc_busy ) sleep_on( &fdc_wait );
fdc_busy = 1;
stdma_lock(floppy_irq, NULL);
Index: linux-2.6.15-rc1/drivers/block/nbd.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/block/nbd.c
+++ linux-2.6.15-rc1/drivers/block/nbd.c
@@ -182,7 +182,7 @@ static int sock_xmit(struct socket *sock
siginfo_t info;
spin_lock_irqsave(¤t->sighand->siglock, flags);
printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n",
- current->pid, current->comm,
+ task_pid(current), current->comm,
dequeue_signal(current, ¤t->blocked, &info));
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
result = -EINTR;
Index: linux-2.6.15-rc1/drivers/cdrom/cdrom.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/cdrom/cdrom.c
+++ linux-2.6.15-rc1/drivers/cdrom/cdrom.c
@@ -1097,7 +1097,7 @@ int open_for_data(struct cdrom_device_in
is the default case! */
cdinfo(CD_OPEN, "bummer. wrong media type.\n");
cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n",
- (unsigned int)current->pid);
+ (unsigned int)task_pid(current));
ret=-EMEDIUMTYPE;
goto clean_up_and_return;
}
Index: linux-2.6.15-rc1/drivers/cdrom/mcdx.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/cdrom/mcdx.c
+++ linux-2.6.15-rc1/drivers/cdrom/mcdx.c
@@ -1351,7 +1351,7 @@ static int mcdx_xfer(struct s_drive_stuf
sector + nr_sectors)
? stuffp->high_border : border;
- stuffp->lock = current->pid;
+ stuffp->lock = task_pid(current);
do {
Index: linux-2.6.15-rc1/drivers/cdrom/sbpcd.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/cdrom/sbpcd.c
+++ linux-2.6.15-rc1/drivers/cdrom/sbpcd.c
@@ -4854,14 +4854,14 @@ static void do_sbpcd_request(request_que
if (!req)
{
printk( "do_sbpcd_request[%di](NULL), Pid:%d, Time:%li\n",
- xnr, current->pid, jiffies);
+ xnr, task_pid(current), jiffies);
printk( "do_sbpcd_request[%do](NULL) end 0 (null), Time:%li\n",
xnr, jiffies);
return;
}
printk(" do_sbpcd_request[%di](%p:%ld+%ld), Pid:%d, Time:%li\n",
- xnr, req, req->sector, req->nr_sectors, current->pid, jiffies);
+ xnr, req, req->sector, req->nr_sectors, task_pid(current), jiffies);
#endif
req = elv_next_request(q); /* take out our request so no other */
Index: linux-2.6.15-rc1/drivers/char/agp/frontend.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/agp/frontend.c
+++ linux-2.6.15-rc1/drivers/char/agp/frontend.c
@@ -611,7 +611,7 @@ static int agp_mmap(struct file *file, s
if ((size + offset) > current_size)
goto out_inval;
- client = agp_find_client_by_pid(current->pid);
+ client = agp_find_client_by_pid(task_pid(current));
if (client == NULL)
goto out_eperm;
@@ -708,13 +708,13 @@ static int agp_open(struct inode *inode,
goto err_out_nomem;
set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
- priv->my_pid = current->pid;
+ priv->my_pid = task_pid(current);
if ((current->uid == 0) || (current->suid == 0)) {
/* Root priv, can be controller */
set_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags);
}
- client = agp_find_client_by_pid(current->pid);
+ client = agp_find_client_by_pid(task_pid(current));
if (client != NULL) {
set_bit(AGP_FF_IS_CLIENT, &priv->access_flags);
Index: linux-2.6.15-rc1/drivers/char/cyclades.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/cyclades.c
+++ linux-2.6.15-rc1/drivers/char/cyclades.c
@@ -2361,7 +2361,7 @@ block_til_ready(struct tty_struct *tty,
CY_UNLOCK(info, flags);
#ifdef CY_DEBUG_COUNT
printk("cyc block_til_ready: (%d): decrementing count to %d\n",
- current->pid, info->count);
+ task_pid(current), info->count);
#endif
info->blocked_open++;
@@ -2478,7 +2478,7 @@ block_til_ready(struct tty_struct *tty,
info->count++;
#ifdef CY_DEBUG_COUNT
printk("cyc:block_til_ready (%d): incrementing count to %d\n",
- current->pid, info->count);
+ task_pid(current), info->count);
#endif
}
info->blocked_open--;
@@ -2579,7 +2579,7 @@ cy_open(struct tty_struct *tty, struct f
info->count++;
#ifdef CY_DEBUG_COUNT
printk("cyc:cy_open (%d): incrementing count to %d\n",
- current->pid, info->count);
+ task_pid(current), info->count);
#endif
if (!tmp_buf) {
page = get_zeroed_page(GFP_KERNEL);
@@ -2745,7 +2745,7 @@ cy_close(struct tty_struct *tty, struct
}
#ifdef CY_DEBUG_COUNT
printk("cyc:cy_close at (%d): decrementing count to %d\n",
- current->pid, info->count - 1);
+ task_pid(current), info->count - 1);
#endif
if (--info->count < 0) {
#ifdef CY_DEBUG_COUNT
@@ -4472,7 +4472,7 @@ cy_hangup(struct tty_struct *tty)
info->event = 0;
info->count = 0;
#ifdef CY_DEBUG_COUNT
- printk("cyc:cy_hangup (%d): setting count to 0\n", current->pid);
+ printk("cyc:cy_hangup (%d): setting count to 0\n", task_pid(current));
#endif
info->tty = NULL;
info->flags &= ~ASYNC_NORMAL_ACTIVE;
Index: linux-2.6.15-rc1/drivers/char/drm/drm_bufs.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/drm_bufs.c
+++ linux-2.6.15-rc1/drivers/char/drm/drm_bufs.c
@@ -1434,7 +1434,7 @@ int drm_freebufs(struct inode *inode, st
buf = dma->buflist[idx];
if (buf->filp != filp) {
DRM_ERROR("Process %d freeing buffer not owned\n",
- current->pid);
+ task_pid(current));
return -EINVAL;
}
drm_free_buffer(dev, buf);
Index: linux-2.6.15-rc1/drivers/char/drm/drm_drv.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/drm_drv.c
+++ linux-2.6.15-rc1/drivers/char/drm/drm_drv.c
@@ -473,7 +473,7 @@ int drm_ioctl(struct inode *inode, struc
++priv->ioctl_count;
DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
- current->pid, cmd, nr,
+ task_pid(current), cmd, nr,
(long)old_encode_dev(priv->head->device),
priv->authenticated);
Index: linux-2.6.15-rc1/drivers/char/drm/drm_fops.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/drm_fops.c
+++ linux-2.6.15-rc1/drivers/char/drm/drm_fops.c
@@ -188,7 +188,7 @@ int drm_release(struct inode *inode, str
*/
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
- current->pid, (long)old_encode_dev(priv->head->device),
+ task_pid(current), (long)old_encode_dev(priv->head->device),
dev->open_count);
if (priv->lock_count && dev->lock.hw_lock &&
@@ -347,7 +347,7 @@ static int drm_open_helper(struct inode
if (!drm_cpu_valid())
return -EINVAL;
- DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);
+ DRM_DEBUG("pid = %d, minor = %d\n", task_pid(current), minor);
priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES);
if (!priv)
@@ -356,7 +356,7 @@ static int drm_open_helper(struct inode
memset(priv, 0, sizeof(*priv));
filp->private_data = priv;
priv->uid = current->euid;
- priv->pid = current->pid;
+ priv->pid = task_pid(current);
priv->minor = minor;
priv->head = drm_heads[minor];
priv->ioctl_count = 0;
@@ -416,7 +416,7 @@ int drm_flush(struct file *filp)
drm_device_t *dev = priv->head->dev;
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
- current->pid, (long)old_encode_dev(priv->head->device),
+ task_pid(current), (long)old_encode_dev(priv->head->device),
dev->open_count);
return 0;
}
Index: linux-2.6.15-rc1/drivers/char/drm/drm_lock.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/drm_lock.c
+++ linux-2.6.15-rc1/drivers/char/drm/drm_lock.c
@@ -67,12 +67,12 @@ int drm_lock(struct inode *inode, struct
if (lock.context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n",
- current->pid, lock.context);
+ task_pid(current), lock.context);
return -EINVAL;
}
DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
- lock.context, current->pid,
+ lock.context, task_pid(current),
dev->lock.hw_lock->lock, lock.flags);
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
@@ -156,7 +156,7 @@ int drm_unlock(struct inode *inode, stru
if (lock.context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n",
- current->pid, lock.context);
+ task_pid(current), lock.context);
return -EINVAL;
}
Index: linux-2.6.15-rc1/drivers/char/drm/drm_os_linux.h
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/drm_os_linux.h
+++ linux-2.6.15-rc1/drivers/char/drm/drm_os_linux.h
@@ -12,7 +12,7 @@
#define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data
#define DRM_ERR(d) -(d)
/** Current process ID */
-#define DRM_CURRENTPID current->pid
+#define DRM_CURRENTPID task_pid(current)
#define DRM_UDELAY(d) udelay(d)
/** Read a byte from a MMIO region */
#define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset))
Index: linux-2.6.15-rc1/drivers/char/drm/drm_vm.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/drm_vm.c
+++ linux-2.6.15-rc1/drivers/char/drm/drm_vm.c
@@ -407,7 +407,7 @@ static void drm_vm_open(struct vm_area_s
down(&dev->struct_sem);
vma_entry->vma = vma;
vma_entry->next = dev->vmalist;
- vma_entry->pid = current->pid;
+ vma_entry->pid = task_pid(current);
dev->vmalist = vma_entry;
up(&dev->struct_sem);
}
Index: linux-2.6.15-rc1/drivers/char/drm/i810_dma.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/i810_dma.c
+++ linux-2.6.15-rc1/drivers/char/drm/i810_dma.c
@@ -1110,7 +1110,7 @@ static int i810_getbuf(struct inode *ino
retcode = i810_dma_get_buffer(dev, &d, filp);
DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n",
- current->pid, retcode, d.granted);
+ task_pid(current), retcode, d.granted);
if (copy_to_user((drm_dma_t __user *) arg, &d, sizeof(d)))
return -EFAULT;
Index: linux-2.6.15-rc1/drivers/char/drm/i830_dma.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/drm/i830_dma.c
+++ linux-2.6.15-rc1/drivers/char/drm/i830_dma.c
@@ -1433,7 +1433,7 @@ static int i830_getbuf(struct inode *ino
retcode = i830_dma_get_buffer(dev, &d, filp);
DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n",
- current->pid, retcode, d.granted);
+ task_pid(current), retcode, d.granted);
if (copy_to_user((drm_dma_t __user *) arg, &d, sizeof(d)))
return -EFAULT;
Index: linux-2.6.15-rc1/drivers/char/n_r3964.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/n_r3964.c
+++ linux-2.6.15-rc1/drivers/char/n_r3964.c
@@ -1068,7 +1068,7 @@ static int r3964_open(struct tty_struct
TRACE_L("open");
TRACE_L("tty=%p, PID=%d, disc_data=%p",
- tty, current->pid, tty->disc_data);
+ tty, task_pid(current), tty->disc_data);
pInfo=kmalloc(sizeof(struct r3964_info), GFP_KERNEL);
TRACE_M("r3964_open - info kmalloc %p",pInfo);
@@ -1193,7 +1193,7 @@ static ssize_t r3964_read(struct tty_str
struct r3964_client_message theMsg;
DECLARE_WAITQUEUE (wait, current);
- int pid = current->pid;
+ int pid = task_pid(current);
int count;
TRACE_L("read()");
@@ -1295,7 +1295,7 @@ static ssize_t r3964_write(struct tty_st
pHeader->locks = 0;
pHeader->owner = NULL;
- pid=current->pid;
+ pid=task_pid(current);
pClient=findClient(pInfo, pid);
if(pClient)
@@ -1328,7 +1328,7 @@ static int r3964_ioctl(struct tty_struct
switch(cmd)
{
case R3964_ENABLE_SIGNALS:
- return enable_signals(pInfo, current->pid, arg);
+ return enable_signals(pInfo, task_pid(current), arg);
case R3964_SETPRIORITY:
if(arg<R3964_MASTER || arg>R3964_SLAVE)
return -EINVAL;
@@ -1341,7 +1341,7 @@ static int r3964_ioctl(struct tty_struct
pInfo->flags &= ~R3964_BCC;
return 0;
case R3964_READ_TELEGRAM:
- return read_telegram(pInfo, current->pid, (unsigned char __user *)arg);
+ return read_telegram(pInfo, task_pid(current), (unsigned char __user *)arg);
default:
return -ENOIOCTLCMD;
}
@@ -1357,7 +1357,7 @@ static unsigned int r3964_poll(struct tt
struct poll_table_struct *wait)
{
struct r3964_info *pInfo=(struct r3964_info*)tty->disc_data;
- int pid=current->pid;
+ int pid=task_pid(current);
struct r3964_client_info *pClient;
struct r3964_message *pMsg=NULL;
unsigned long flags;
Index: linux-2.6.15-rc1/drivers/char/random.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/random.c
+++ linux-2.6.15-rc1/drivers/char/random.c
@@ -1640,7 +1640,7 @@ unsigned int get_random_int(void)
* drain on it), and uses halfMD4Transform within the second. We
* also mix it with jiffies and the PID:
*/
- return secure_ip_id(current->pid + jiffies);
+ return secure_ip_id(task_pid(current) + jiffies);
}
/*
Index: linux-2.6.15-rc1/drivers/char/rio/linux_compat.h
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/rio/linux_compat.h
+++ linux-2.6.15-rc1/drivers/char/rio/linux_compat.h
@@ -58,7 +58,7 @@ struct ttystatics {
#endif
-#define getpid() (current->pid)
+#define getpid() (task_pid(current))
#define QSIZE SERIAL_XMIT_SIZE
Index: linux-2.6.15-rc1/drivers/char/snsc_event.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/snsc_event.c
+++ linux-2.6.15-rc1/drivers/char/snsc_event.c
@@ -207,7 +207,7 @@ scdrv_dispatch_event(char *event, int le
/* first find init's task */
read_lock(&tasklist_lock);
for_each_process(p) {
- if (p->pid == 1)
+ if (task_pid(p) == 1)
break;
}
if (p) { /* we found init's task */
Index: linux-2.6.15-rc1/drivers/char/sx.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/sx.c
+++ linux-2.6.15-rc1/drivers/char/sx.c
@@ -1437,7 +1437,7 @@ static int sx_open (struct tty_struct *
line = tty->index;
sx_dprintk (SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, np=%d)\n",
- current->pid, line, tty, current->signal->tty, sx_nports);
+ task_pid(current), line, tty, current->signal->tty, sx_nports);
if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports))
return -ENODEV;
Index: linux-2.6.15-rc1/drivers/char/sysrq.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/sysrq.c
+++ linux-2.6.15-rc1/drivers/char/sysrq.c
@@ -207,7 +207,7 @@ static void send_sig_all(int sig)
struct task_struct *p;
for_each_process(p) {
- if (p->mm && p->pid != 1)
+ if (p->mm && task_pid(p) != 1)
/* Not swapper, init nor kernel thread */
force_sig(sig, p);
}
Index: linux-2.6.15-rc1/drivers/char/tty_io.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/tty_io.c
+++ linux-2.6.15-rc1/drivers/char/tty_io.c
@@ -2009,7 +2009,7 @@ static int tty_fasync(int fd, struct fil
if (on) {
if (!waitqueue_active(&tty->read_wait))
tty->minimum_to_wake = 1;
- retval = f_setown(filp, (-tty->pgrp) ? : current->pid, 0);
+ retval = f_setown(filp, (-tty->pgrp) ? : task_pid(current), 0);
if (retval)
return retval;
} else {
@@ -2471,7 +2471,7 @@ static void __do_SAK(void *arg)
if (p->signal->tty == tty || session > 0) {
printk(KERN_NOTICE "SAK: killed process %d"
" (%s): p->signal->session==tty->session\n",
- p->pid, p->comm);
+ task_pid(p), p->comm);
send_sig(SIGKILL, p, 1);
continue;
}
@@ -2487,7 +2487,7 @@ static void __do_SAK(void *arg)
filp->private_data == tty) {
printk(KERN_NOTICE "SAK: killed process %d"
" (%s): fd#%d opened to the tty\n",
- p->pid, p->comm, i);
+ task_pid(p), p->comm, i);
send_sig(SIGKILL, p, 1);
break;
}
Index: linux-2.6.15-rc1/drivers/char/vt_ioctl.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/char/vt_ioctl.c
+++ linux-2.6.15-rc1/drivers/char/vt_ioctl.c
@@ -651,7 +651,7 @@ int vt_ioctl(struct tty_struct *tty, str
return -EPERM;
if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
return -EINVAL;
- spawnpid = current->pid;
+ spawnpid = task_pid(current);
spawnsig = arg;
return 0;
}
@@ -670,7 +670,7 @@ int vt_ioctl(struct tty_struct *tty, str
vc->vt_mode = tmp;
/* the frsig is ignored, so we set it to 0 */
vc->vt_mode.frsig = 0;
- vc->vt_pid = current->pid;
+ vc->vt_pid = task_pid(current);
/* no switch is required -- saw@shade.msu.ru */
vc->vt_newvt = -1;
release_console_sem();
Index: linux-2.6.15-rc1/drivers/input/joystick/iforce/iforce-main.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/input/joystick/iforce/iforce-main.c
+++ linux-2.6.15-rc1/drivers/input/joystick/iforce/iforce-main.c
@@ -160,7 +160,7 @@ static int iforce_upload_effect(struct i
return -ENOMEM;
effect->id = id;
- iforce->core_effects[id].owner = current->pid;
+ iforce->core_effects[id].owner = task_pid(current);
iforce->core_effects[id].flags[0] = (1 << FF_CORE_IS_USED); /* Only IS_USED bit must be set */
is_update = FALSE;
@@ -223,8 +223,8 @@ static int iforce_erase_effect(struct in
struct iforce_core_effect* core_effect;
/* Check who is trying to erase this effect */
- if (iforce->core_effects[effect_id].owner != current->pid) {
- printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, iforce->core_effects[effect_id].owner);
+ if (iforce->core_effects[effect_id].owner != task_pid(current)) {
+ printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", task_pid(current), iforce->core_effects[effect_id].owner);
return -EACCES;
}
@@ -274,7 +274,7 @@ static int iforce_flush(struct input_dev
for (i=0; i<dev->ff_effects_max; ++i) {
if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags) &&
- current->pid == iforce->core_effects[i].owner) {
+ task_pid(current) == iforce->core_effects[i].owner) {
/* Stop effect */
input_report_ff(dev, i, 0);
Index: linux-2.6.15-rc1/drivers/input/joystick/iforce/iforce.h
===================================================================
--- linux-2.6.15-rc1.orig/drivers/input/joystick/iforce/iforce.h
+++ linux-2.6.15-rc1/drivers/input/joystick/iforce/iforce.h
@@ -70,8 +70,8 @@
#define CHECK_OWNERSHIP(i, iforce) \
((i) < FF_EFFECTS_MAX && i >= 0 && \
test_bit(FF_CORE_IS_USED, (iforce)->core_effects[(i)].flags) && \
- (current->pid == 0 || \
- (iforce)->core_effects[(i)].owner == current->pid))
+ (task_pid(current) == 0 || \
+ (iforce)->core_effects[(i)].owner == task_pid(current)))
struct iforce_core_effect {
/* Information about where modifiers are stored in the device's memory */
Index: linux-2.6.15-rc1/drivers/macintosh/adb.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/macintosh/adb.c
+++ linux-2.6.15-rc1/drivers/macintosh/adb.c
@@ -138,8 +138,8 @@ static void printADBreply(struct adb_req
static __inline__ void adb_wait_ms(unsigned int ms)
{
- if (current->pid && adb_probe_task_pid &&
- adb_probe_task_pid == current->pid)
+ if (task_pid(current) && adb_probe_task_pid &&
+ adb_probe_task_pid == task_pid(current))
msleep(ms);
else
mdelay(ms);
@@ -492,8 +492,8 @@ adb_request(struct adb_request *req, voi
* block. Beware that the "done" callback will be overriden !
*/
if ((flags & ADBREQ_SYNC) &&
- (current->pid && adb_probe_task_pid &&
- adb_probe_task_pid == current->pid)) {
+ (task_pid(current) && adb_probe_task_pid &&
+ adb_probe_task_pid == task_pid(current))) {
req->done = adb_probe_wakeup;
rc = adb_controller->send_request(req, 0);
if (rc || req->complete)
Index: linux-2.6.15-rc1/drivers/md/bitmap.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/md/bitmap.c
+++ linux-2.6.15-rc1/drivers/md/bitmap.c
@@ -1223,7 +1223,7 @@ static mdk_thread_t *bitmap_start_daemon
md_wakeup_thread(daemon); /* start it running */
PRINTK("%s: %s daemon (pid %d) started...\n",
- bmname(bitmap), name, daemon->tsk->pid);
+ bmname(bitmap), name, daemon->task_pid(tsk));
return daemon;
}
@@ -1232,7 +1232,7 @@ static void bitmap_stop_daemon(struct bi
{
/* the daemon can't stop itself... it'll just exit instead... */
if (bitmap->writeback_daemon && ! IS_ERR(bitmap->writeback_daemon) &&
- current->pid != bitmap->writeback_daemon->tsk->pid) {
+ task_pid(current) != task_pid(bitmap->writeback_daemon->tsk)) {
mdk_thread_t *daemon;
unsigned long flags;
Index: linux-2.6.15-rc1/drivers/md/md.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/md/md.c
+++ linux-2.6.15-rc1/drivers/md/md.c
@@ -3157,7 +3157,7 @@ static int md_ioctl(struct inode *inode,
printk(KERN_WARNING
"md: %s(pid %d) used deprecated START_ARRAY ioctl. "
"This will not be supported beyond 2.6\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
cnt--;
}
err = autostart_array(new_decode_dev(arg));
@@ -3345,7 +3345,7 @@ static int md_ioctl(struct inode *inode,
printk(KERN_WARNING "md: %s(pid %d) used"
" obsolete MD ioctl, upgrade your"
" software to use new ictls.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
err = -EINVAL;
goto abort_unlock;
}
@@ -3485,7 +3485,7 @@ mdk_thread_t *md_register_thread(void (*
void md_unregister_thread(mdk_thread_t *thread)
{
- dprintk("interrupting MD-thread pid %d\n", thread->tsk->pid);
+ dprintk("interrupting MD-thread pid %d\n", task_pid(thread->tsk));
kthread_stop(thread->tsk);
kfree(thread);
Index: linux-2.6.15-rc1/drivers/media/video/zoran_driver.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/media/video/zoran_driver.c
+++ linux-2.6.15-rc1/drivers/media/video/zoran_driver.c
@@ -1342,7 +1342,7 @@ zoran_open (struct inode *inode,
}
dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n",
- ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
+ ZR_DEVNAME(zr), current->comm, task_pid(current), zr->user);
/* now, create the open()-specific file_ops struct */
fh = kmalloc(sizeof(struct zoran_fh), GFP_KERNEL);
@@ -1416,7 +1416,7 @@ zoran_close (struct inode *inode,
struct zoran *zr = fh->zr;
dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n",
- ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
+ ZR_DEVNAME(zr), current->comm, task_pid(current), zr->user);
/* kernel locks (fs/device.c), so don't do that ourselves
* (prevents deadlocks) */
Index: linux-2.6.15-rc1/drivers/net/slip.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/net/slip.c
+++ linux-2.6.15-rc1/drivers/net/slip.c
@@ -749,7 +749,7 @@ sl_alloc(dev_t line)
if (sl->tty)
continue;
- if (current->pid == sl->pid) {
+ if (task_pid(current) == sl->pid) {
if (sl->line == line && score < 3) {
sel = i;
score = 3;
@@ -867,7 +867,7 @@ static int slip_open(struct tty_struct *
sl->tty = tty;
tty->disc_data = sl;
sl->line = tty_devnum(tty);
- sl->pid = current->pid;
+ sl->pid = task_pid(current);
/* FIXME: already done before we were called - seems this can go */
if (tty->driver->flush_buffer)
@@ -1303,7 +1303,7 @@ static int sl_ioctl(struct net_device *d
/* Resolve race condition, when ioctl'ing hanged up
and opened by another process device.
*/
- if (sl->tty != current->signal->tty && sl->pid != current->pid) {
+ if (sl->tty != current->signal->tty && sl->pid != task_pid(current)) {
spin_unlock_bh(&sl->lock);
return -EPERM;
}
Index: linux-2.6.15-rc1/drivers/net/tun.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/net/tun.c
+++ linux-2.6.15-rc1/drivers/net/tun.c
@@ -709,7 +709,7 @@ static int tun_chr_fasync(int fd, struct
return ret;
if (on) {
- ret = f_setown(file, current->pid, 0);
+ ret = f_setown(file, task_pid(current), 0);
if (ret)
return ret;
tun->flags |= TUN_FASYNC;
Index: linux-2.6.15-rc1/drivers/net/wireless/hostap/hostap_ioctl.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/net/wireless/hostap/hostap_ioctl.c
+++ linux-2.6.15-rc1/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -2923,7 +2923,7 @@ static int prism2_ioctl_priv_monitor(str
printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor "
"- update software to use iwconfig mode monitor\n",
- dev->name, current->pid, current->comm);
+ dev->name, task_pid(current), current->comm);
/* Backward compatibility code - this can be removed at some point */
Index: linux-2.6.15-rc1/drivers/oprofile/buffer_sync.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/oprofile/buffer_sync.c
+++ linux-2.6.15-rc1/drivers/oprofile/buffer_sync.c
@@ -286,12 +286,12 @@ add_user_ctx_switch(struct task_struct c
{
add_event_entry(ESCAPE_CODE);
add_event_entry(CTX_SWITCH_CODE);
- add_event_entry(task->pid);
+ add_event_entry(task_pid(task));
add_event_entry(cookie);
/* Another code for daemon back-compat */
add_event_entry(ESCAPE_CODE);
add_event_entry(CTX_TGID_CODE);
- add_event_entry(task->tgid);
+ add_event_entry(task_tgid(task));
}
Index: linux-2.6.15-rc1/drivers/s390/char/fs3270.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/s390/char/fs3270.c
+++ linux-2.6.15-rc1/drivers/s390/char/fs3270.c
@@ -444,7 +444,7 @@ fs3270_open(struct inode *inode, struct
return PTR_ERR(fp);
init_waitqueue_head(&fp->wait);
- fp->fs_pid = current->pid;
+ fp->fs_pid = task_pid(current);
rc = raw3270_add_view(&fp->view, &fs3270_fn, minor);
if (rc) {
fs3270_free_view(&fp->view);
Index: linux-2.6.15-rc1/drivers/s390/crypto/z90main.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/s390/crypto/z90main.c
+++ linux-2.6.15-rc1/drivers/s390/crypto/z90main.c
@@ -185,7 +185,7 @@ extern char z90hardware_version[];
/**
* PID() expands to the process ID of the current process
*/
-#define PID() (current->pid)
+#define PID() (task_pid(current))
/**
* Selected Constants. The number of APs and the number of devices
@@ -942,7 +942,7 @@ init_work_element(struct work_element *w
step = atomic_inc_return(&z90crypt_step);
memcpy(we_p->caller_id+0, (void *) &pid, sizeof(pid));
memcpy(we_p->caller_id+4, (void *) &step, sizeof(step));
- we_p->pid = pid;
+ we_task_pid(p) = pid;
we_p->priv_data = priv_data;
we_p->status[0] = STAT_DEFAULT;
we_p->audit[0] = 0x00;
Index: linux-2.6.15-rc1/drivers/s390/s390mach.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/s390/s390mach.c
+++ linux-2.6.15-rc1/drivers/s390/s390mach.c
@@ -183,7 +183,7 @@ s390_handle_mcck(void)
printk(KERN_EMERG "mcck: Terminating task because of machine "
"malfunction (code 0x%016llx).\n", mcck.mcck_code);
printk(KERN_EMERG "mcck: task: %s, pid: %d.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
do_exit(SIGSEGV);
}
}
Index: linux-2.6.15-rc1/drivers/scsi/53c7xx.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/scsi/53c7xx.c
+++ linux-2.6.15-rc1/drivers/scsi/53c7xx.c
@@ -4208,7 +4208,7 @@ restart:
if (hostdata->options & OPTION_DEBUG_INTR) {
printk ("scsi%d : command complete : pid %lu, id %d,lun %d result 0x%x ",
- host->host_no, tmp->pid, tmp->device->id, tmp->device->lun, tmp->result);
+ host->host_no, tmtask_pid(p), tmp->device->id, tmp->device->lun, tmp->result);
__scsi_print_command (tmp->cmnd);
}
Index: linux-2.6.15-rc1/drivers/scsi/dc395x.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/scsi/dc395x.c
+++ linux-2.6.15-rc1/drivers/scsi/dc395x.c
@@ -3554,7 +3554,7 @@ static void doing_srb_done(struct Adapte
p = srb->cmd;
dir = p->sc_data_direction;
result = MK_RES(0, did_flag, 0, 0);
- printk("G:%li(%02i-%i) ", p->pid,
+ printk("G:%li(%02i-%i) ", task_pid(p),
p->device->id, p->device->lun);
srb_going_remove(dcb, srb);
free_tag(dcb, srb);
@@ -3584,7 +3584,7 @@ static void doing_srb_done(struct Adapte
p = srb->cmd;
result = MK_RES(0, did_flag, 0, 0);
- printk("W:%li<%02i-%i>", p->pid, p->device->id,
+ printk("W:%li<%02i-%i>", task_pid(p), p->device->id,
p->device->lun);
srb_waiting_remove(dcb, srb);
srb_free_insert(acb, srb);
Index: linux-2.6.15-rc1/drivers/scsi/eata_pio.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/scsi/eata_pio.c
+++ linux-2.6.15-rc1/drivers/scsi/eata_pio.c
@@ -512,7 +512,7 @@ static int eata_pio_host_reset(struct sc
sp = HD(cmd)->ccb[x].cmd;
HD(cmd)->ccb[x].status = RESET;
- printk(KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n", x, sp->pid);
+ printk(KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n", x, stask_pid(p));
if (sp == NULL)
panic("eata_pio_reset: slot %d, sp==NULL.\n", x);
Index: linux-2.6.15-rc1/drivers/serial/crisv10.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/serial/crisv10.c
+++ linux-2.6.15-rc1/drivers/serial/crisv10.c
@@ -4346,7 +4346,7 @@ rs_close(struct tty_struct *tty, struct
}
#ifdef SERIAL_DEBUG_OPEN
- printk("[%d] rs_close ttyS%d, count = %d\n", current->pid,
+ printk("[%d] rs_close ttyS%d, count = %d\n", task_pid(current),
info->line, info->count);
#endif
if ((tty->count == 1) && (info->count != 1)) {
@@ -4639,7 +4639,7 @@ rs_open(struct tty_struct *tty, struct f
return -ENODEV;
#ifdef SERIAL_DEBUG_OPEN
- printk("[%d] rs_open %s, count = %d\n", current->pid, tty->name,
+ printk("[%d] rs_open %s, count = %d\n", task_pid(current), tty->name,
info->count);
#endif
Index: linux-2.6.15-rc1/drivers/usb/input/hid-lgff.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/usb/input/hid-lgff.c
+++ linux-2.6.15-rc1/drivers/usb/input/hid-lgff.c
@@ -55,8 +55,8 @@
#define DEVICE_CLOSING 0 /* The driver is being unitialised */
/* Check that the current process can access an effect */
-#define CHECK_OWNERSHIP(effect) (current->pid == 0 \
- || effect.owner == current->pid)
+#define CHECK_OWNERSHIP(effect) (task_pid(current) == 0 \
+ || effect.owner == task_pid(current))
#define LGFF_CHECK_OWNERSHIP(i, l) \
(i>=0 && i<LGFF_EFFECTS \
@@ -340,7 +340,7 @@ static int hid_lgff_flush(struct input_d
modified is when effects are uploaded or when an effect is
erased. But a process cannot close its dev/input/eventX fd
and perform ioctls on the same fd all at the same time */
- if ( current->pid == lgff->effects[i].owner
+ if ( task_pid(current) == lgff->effects[i].owner
&& test_bit(EFFECT_USED, lgff->effects[i].flags)) {
if (hid_lgff_erase(dev, i))
@@ -392,7 +392,7 @@ static int hid_lgff_upload_effect(struct
}
effect->id = i;
- lgff->effects[i].owner = current->pid;
+ lgff->effects[i].owner = task_pid(current);
lgff->effects[i].flags[0] = 0;
set_bit(EFFECT_USED, lgff->effects[i].flags);
}
Index: linux-2.6.15-rc1/drivers/usb/input/hid-tmff.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/usb/input/hid-tmff.c
+++ linux-2.6.15-rc1/drivers/usb/input/hid-tmff.c
@@ -51,8 +51,8 @@
#define DEVICE_CLOSING 0 /* The driver is being unitialised */
/* Check that the current process can access an effect */
-#define CHECK_OWNERSHIP(effect) (current->pid == 0 \
- || effect.owner == current->pid)
+#define CHECK_OWNERSHIP(effect) (task_pid(current) == 0 \
+ || effect.owner == task_pid(current))
#define TMFF_CHECK_ID(id) ((id) >= 0 && (id) < TMFF_EFFECTS)
@@ -255,7 +255,7 @@ static int hid_tmff_flush(struct input_d
erased. But a process cannot close its dev/input/eventX fd
and perform ioctls on the same fd all at the same time */
- if (current->pid == tmff->effects[i].owner
+ if (task_pid(current) == tmff->effects[i].owner
&& test_bit(EFFECT_USED, tmff->effects[i].flags))
if (hid_tmff_erase(dev, i))
warn("erase effect %d failed", i);
@@ -310,7 +310,7 @@ static int hid_tmff_upload_effect(struct
}
effect->id = id;
- tmff->effects[id].owner = current->pid;
+ tmff->effects[id].owner = task_pid(current);
tmff->effects[id].flags[0] = 0;
set_bit(EFFECT_USED, tmff->effects[id].flags);
Index: linux-2.6.15-rc1/drivers/usb/input/pid.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/usb/input/pid.c
+++ linux-2.6.15-rc1/drivers/usb/input/pid.c
@@ -42,8 +42,8 @@
#define CHECK_OWNERSHIP(i, hid_pid) \
((i) < FF_EFFECTS_MAX && i >= 0 && \
test_bit(FF_PID_FLAGS_USED, &hid_pid->effects[(i)].flags) && \
- (current->pid == 0 || \
- (hid_pid)->effects[(i)].owner == current->pid))
+ (task_pid(current) == 0 || \
+ (hid_pid)->effects[(i)].owner == task_pid(current)))
/* Called when a transfer is completed */
static void hid_pid_ctrl_out(struct urb *u, struct pt_regs *regs)
@@ -153,7 +153,7 @@ static int hid_pid_flush(struct input_de
and perform ioctls on the same fd all at the same time */
/*FIXME: multiple threads, anyone? */
for (i = 0; i < dev->ff_effects_max; ++i)
- if (current->pid == pid->effects[i].owner
+ if (task_pid(current) == pid->effects[i].owner
&& test_bit(FF_PID_FLAGS_USED, &pid->effects[i].flags))
if (hid_pid_erase(dev, i))
dev_warn(&hid->dev->dev, "erase effect %d failed", i);
@@ -199,7 +199,7 @@ static int hid_pid_upload_effect(struct
effect->id = id;
dev_dbg(&pid_private->hid->dev->dev, "effect ID is %d.\n", id);
- pid_private->effects[id].owner = current->pid;
+ pid_private->effects[id].owner = task_pid(current);
pid_private->effects[id].flags = (1 << FF_PID_FLAGS_USED);
spin_unlock_irqrestore(&pid_private->lock, flags);
Index: linux-2.6.15-rc1/drivers/usb/core/devio.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/usb/core/devio.c
+++ linux-2.6.15-rc1/drivers/usb/core/devio.c
@@ -466,7 +466,7 @@ static int checkintf(struct dev_state *p
return 0;
/* if not yet claimed, claim it for the driver */
dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
- current->pid, current->comm, ifnum);
+ task_pid(current), current->comm, ifnum);
return claimintf(ps, ifnum);
}
@@ -572,7 +572,7 @@ static int usbdev_open(struct inode *ino
INIT_LIST_HEAD(&ps->async_completed);
init_waitqueue_head(&ps->wait);
ps->discsignr = 0;
- ps->disc_pid = current->pid;
+ ps->disc_pid = task_pid(current);
ps->disc_uid = current->uid;
ps->disc_euid = current->euid;
ps->disccontext = NULL;
@@ -1055,7 +1055,7 @@ static int proc_do_submiturb(struct dev_
as->userbuffer = NULL;
as->signr = uurb->signr;
as->ifnum = ifnum;
- as->pid = current->pid;
+ as->pid = task_pid(current);
as->uid = current->uid;
as->euid = current->euid;
if (!(uurb->endpoint & USB_DIR_IN)) {
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 02/13] Change pid accesses: most archs
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 01/13] Change pid accesses: drivers Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 03/13] Change pid accesses: filesystems Serge E. Hallyn
` (14 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B1-change-pid-tgid-references-arches --]
[-- Type: text/plain, Size: 86764 bytes --]
Replace-Subject: Change pid accesses: most archs
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for most architectures.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
arch/alpha/kernel/semaphore.c | 16 ++++++++--------
arch/alpha/kernel/signal.c | 4 ++--
arch/alpha/kernel/traps.c | 6 +++---
arch/alpha/mm/fault.c | 4 ++--
arch/arm/kernel/process.c | 2 +-
arch/arm/kernel/ptrace.c | 4 ++--
arch/arm/kernel/traps.c | 10 +++++-----
arch/arm/mm/alignment.c | 2 +-
arch/arm/mm/fault.c | 2 +-
arch/arm/nwfpe/fpmodule.c | 2 +-
arch/arm26/kernel/ptrace.c | 2 +-
arch/arm26/kernel/traps.c | 12 ++++++------
arch/arm26/mm/fault.c | 2 +-
arch/arm26/nwfpe/fpmodule.c | 2 +-
arch/cris/arch-v10/kernel/traps.c | 2 +-
arch/cris/arch-v32/kernel/process.c | 2 +-
arch/cris/arch-v32/kernel/ptrace.c | 4 ++--
arch/cris/arch-v32/kernel/signal.c | 2 +-
arch/cris/arch-v32/kernel/traps.c | 2 +-
arch/cris/kernel/profile.c | 2 +-
arch/frv/kernel/gdb-stub.c | 2 +-
arch/frv/kernel/ptrace.c | 10 +++++-----
arch/frv/kernel/semaphore.c | 2 +-
arch/frv/kernel/signal.c | 4 ++--
arch/frv/kernel/traps.c | 4 ++--
arch/frv/mm/fault.c | 4 ++--
arch/h8300/kernel/traps.c | 2 +-
arch/i386/kernel/crash.c | 2 +-
arch/i386/kernel/process.c | 2 +-
arch/i386/kernel/signal.c | 4 ++--
arch/i386/kernel/traps.c | 2 +-
arch/i386/lib/usercopy.c | 2 +-
arch/i386/mm/fault.c | 2 +-
arch/m32r/kernel/process.c | 8 ++++----
arch/m32r/kernel/signal.c | 2 +-
arch/m32r/kernel/traps.c | 2 +-
arch/m32r/mm/fault.c | 2 +-
arch/m68k/kernel/traps.c | 6 +++---
arch/m68k/mac/macints.c | 2 +-
arch/m68k/mm/fault.c | 2 +-
arch/m68knommu/kernel/process.c | 2 +-
arch/m68knommu/kernel/time.c | 2 +-
arch/m68knommu/kernel/traps.c | 4 ++--
arch/m68knommu/platform/5307/timers.c | 2 +-
arch/parisc/kernel/signal.c | 4 ++--
arch/parisc/kernel/smp.c | 5 +++--
arch/parisc/kernel/sys_parisc32.c | 2 +-
arch/parisc/kernel/traps.c | 12 ++++++------
arch/parisc/kernel/unaligned.c | 2 +-
arch/parisc/mm/fault.c | 2 +-
arch/powerpc/kernel/process.c | 2 +-
arch/powerpc/kernel/traps.c | 4 ++--
arch/powerpc/mm/fault.c | 2 +-
arch/powerpc/platforms/pseries/ras.c | 4 ++--
arch/powerpc/xmon/xmon.c | 2 +-
arch/ppc/kernel/process.c | 6 +++---
arch/ppc/kernel/softemu8xx.c | 2 +-
arch/ppc/kernel/traps.c | 4 ++--
arch/ppc/lib/locks.c | 6 +++---
arch/ppc/mm/fault.c | 2 +-
arch/ppc/xmon/xmon.c | 2 +-
arch/s390/kernel/asm-offsets.c | 2 +-
arch/s390/kernel/process.c | 2 +-
arch/s390/math-emu/math.c | 2 +-
arch/s390/mm/fault.c | 2 +-
arch/sh/kernel/process.c | 2 +-
arch/sh/kernel/signal.c | 4 ++--
arch/sh/kernel/traps.c | 2 +-
arch/sh/mm/fault.c | 2 +-
arch/sh64/kernel/process.c | 2 +-
arch/sh64/kernel/signal.c | 4 ++--
arch/sh64/kernel/traps.c | 4 ++--
arch/sh64/lib/dbg.c | 12 ++++++------
arch/sh64/mm/fault.c | 10 +++++-----
arch/sparc/kernel/process.c | 2 +-
arch/sparc/kernel/ptrace.c | 8 ++++----
arch/sparc/kernel/setup.c | 2 +-
arch/sparc/kernel/sys_sparc.c | 2 +-
arch/sparc/kernel/sys_sunos.c | 2 +-
arch/sparc/kernel/traps.c | 4 ++--
arch/sparc/mm/fault.c | 6 +++---
arch/sparc64/kernel/process.c | 2 +-
arch/sparc64/kernel/setup.c | 2 +-
arch/sparc64/kernel/sys_sunos32.c | 2 +-
arch/sparc64/kernel/traps.c | 2 +-
arch/sparc64/solaris/ioctl.c | 4 ++--
arch/um/kernel/process_kern.c | 4 ++--
arch/um/kernel/skas/process_kern.c | 4 ++--
arch/um/kernel/trap_kern.c | 2 +-
arch/um/sys-x86_64/sysrq.c | 2 +-
arch/v850/kernel/bug.c | 4 ++--
arch/v850/kernel/signal.c | 4 ++--
arch/x86_64/ia32/ia32_signal.c | 4 ++--
arch/x86_64/ia32/ptrace32.c | 2 +-
arch/x86_64/kernel/asm-offsets.c | 2 +-
arch/x86_64/kernel/mce.c | 2 +-
arch/x86_64/kernel/process.c | 2 +-
arch/x86_64/kernel/signal.c | 10 +++++-----
arch/x86_64/kernel/traps.c | 6 +++---
arch/x86_64/mm/fault.c | 8 ++++----
arch/xtensa/kernel/signal.c | 4 ++--
arch/xtensa/kernel/syscalls.c | 4 ++--
arch/xtensa/kernel/traps.c | 6 +++---
arch/xtensa/mm/fault.c | 4 ++--
drivers/s390/crypto/z90main.c | 2 +-
105 files changed, 194 insertions(+), 193 deletions(-)
Index: linux-2.6.15-rc1/arch/i386/kernel/crash.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/i386/kernel/crash.c
+++ linux-2.6.15-rc1/arch/i386/kernel/crash.c
@@ -73,7 +73,7 @@ static void crash_save_this_cpu(struct p
*/
buf = &crash_notes[cpu][0];
memset(&prstatus, 0, sizeof(prstatus));
- prstatus.pr_pid = current->pid;
+ prstatus.pr_pid = task_pid(current);
elf_core_copy_regs(&prstatus.pr_reg, regs);
buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus,
sizeof(prstatus));
Index: linux-2.6.15-rc1/arch/i386/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/i386/kernel/process.c
+++ linux-2.6.15-rc1/arch/i386/kernel/process.c
@@ -290,7 +290,7 @@ void show_regs(struct pt_regs * regs)
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
printk("\n");
- printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
+ printk("Pid: %d, comm: %20s\n", task_pid(current), current->comm);
printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id());
print_symbol("EIP is at %s\n", regs->eip);
Index: linux-2.6.15-rc1/arch/i386/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/i386/kernel/signal.c
+++ linux-2.6.15-rc1/arch/i386/kernel/signal.c
@@ -430,7 +430,7 @@ static int setup_frame(int sig, struct k
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
- current->comm, current->pid, frame, regs->eip, frame->pretcode);
+ current->comm, task_pid(current), frame, regs->eip, frame->pretcode);
#endif
return 1;
@@ -524,7 +524,7 @@ static int setup_rt_frame(int sig, struc
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
- current->comm, current->pid, frame, regs->eip, frame->pretcode);
+ current->comm, task_pid(current), frame, regs->eip, frame->pretcode);
#endif
return 1;
Index: linux-2.6.15-rc1/arch/i386/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/i386/kernel/traps.c
+++ linux-2.6.15-rc1/arch/i386/kernel/traps.c
@@ -228,7 +228,7 @@ void show_registers(struct pt_regs *regs
printk("ds: %04x es: %04x ss: %04x\n",
regs->xds & 0xffff, regs->xes & 0xffff, ss);
printk("Process %s (pid: %d, threadinfo=%p task=%p)",
- current->comm, current->pid, current_thread_info(), current);
+ current->comm, task_pid(current), current_thread_info(), current);
/*
* When in-kernel, we also print out the stack and code at the
* time of the fault..
Index: linux-2.6.15-rc1/arch/i386/lib/usercopy.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/i386/lib/usercopy.c
+++ linux-2.6.15-rc1/arch/i386/lib/usercopy.c
@@ -543,7 +543,7 @@ survive:
retval = get_user_pages(current, current->mm,
(unsigned long )to, 1, 1, 0, &pg, NULL);
- if (retval == -ENOMEM && current->pid == 1) {
+ if (retval == -ENOMEM && task_pid(current) == 1) {
up_read(¤t->mm->mmap_sem);
blk_congestion_wait(WRITE, HZ/50);
goto survive;
Index: linux-2.6.15-rc1/arch/i386/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/i386/mm/fault.c
+++ linux-2.6.15-rc1/arch/i386/mm/fault.c
@@ -485,7 +485,7 @@ no_context:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (tsk->pid == 1) {
+ if (task_pid(tsk) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/alpha/kernel/semaphore.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/alpha/kernel/semaphore.c
+++ linux-2.6.15-rc1/arch/alpha/kernel/semaphore.c
@@ -69,7 +69,7 @@ __down_failed(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down failed(%p)\n",
- tsk->comm, tsk->pid, sem);
+ tsk->comm, task_pid(tsk), sem);
#endif
tsk->state = TASK_UNINTERRUPTIBLE;
@@ -98,7 +98,7 @@ __down_failed(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down acquired(%p)\n",
- tsk->comm, tsk->pid, sem);
+ tsk->comm, task_pid(tsk), sem);
#endif
}
@@ -111,7 +111,7 @@ __down_failed_interruptible(struct semap
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down failed(%p)\n",
- tsk->comm, tsk->pid, sem);
+ tsk->comm, task_pid(tsk), sem);
#endif
tsk->state = TASK_INTERRUPTIBLE;
@@ -139,7 +139,7 @@ __down_failed_interruptible(struct semap
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down %s(%p)\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
(ret < 0 ? "interrupted" : "acquired"), sem);
#endif
return ret;
@@ -168,7 +168,7 @@ down(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p) <count=%d> from %p\n",
- current->comm, current->pid, sem,
+ current->comm, task_pid(current), sem,
atomic_read(&sem->count), __builtin_return_address(0));
#endif
__down(sem);
@@ -182,7 +182,7 @@ down_interruptible(struct semaphore *sem
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p) <count=%d> from %p\n",
- current->comm, current->pid, sem,
+ current->comm, task_pid(current), sem,
atomic_read(&sem->count), __builtin_return_address(0));
#endif
return __down_interruptible(sem);
@@ -201,7 +201,7 @@ down_trylock(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down_trylock %s from %p\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
ret ? "failed" : "acquired",
__builtin_return_address(0));
#endif
@@ -217,7 +217,7 @@ up(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): up(%p) <count=%d> from %p\n",
- current->comm, current->pid, sem,
+ current->comm, task_pid(current), sem,
atomic_read(&sem->count), __builtin_return_address(0));
#endif
__up(sem);
Index: linux-2.6.15-rc1/arch/alpha/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/alpha/kernel/signal.c
+++ linux-2.6.15-rc1/arch/alpha/kernel/signal.c
@@ -479,7 +479,7 @@ setup_frame(int sig, struct k_sigaction
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
- current->comm, current->pid, frame, regs->pc, regs->r26);
+ current->comm, task_pid(current), frame, regs->pc, regs->r26);
#endif
return;
@@ -541,7 +541,7 @@ setup_rt_frame(int sig, struct k_sigacti
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
- current->comm, current->pid, frame, regs->pc, regs->r26);
+ current->comm, task_pid(current), frame, regs->pc, regs->r26);
#endif
return;
Index: linux-2.6.15-rc1/arch/alpha/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/alpha/kernel/traps.c
+++ linux-2.6.15-rc1/arch/alpha/kernel/traps.c
@@ -183,7 +183,7 @@ die_if_kernel(char * str, struct pt_regs
#ifdef CONFIG_SMP
printk("CPU %d ", hard_smp_processor_id());
#endif
- printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err);
+ printk("%s(%d): %s %ld\n", current->comm, task_pid(current), str, err);
dik_show_regs(regs, r9_15);
dik_show_trace((unsigned long *)(regs+1));
dik_show_code((unsigned int *)regs->pc);
@@ -646,7 +646,7 @@ got_exception:
lock_kernel();
printk("%s(%d): unhandled unaligned exception\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
pc, una_reg(26), regs->ps);
@@ -786,7 +786,7 @@ do_entUnaUser(void __user * va, unsigned
}
if (++cnt < 5) {
printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
regs->pc - 4, va, opcode, reg);
}
last_time = jiffies;
Index: linux-2.6.15-rc1/arch/alpha/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/alpha/mm/fault.c
+++ linux-2.6.15-rc1/arch/alpha/mm/fault.c
@@ -194,13 +194,13 @@ do_page_fault(unsigned long address, uns
/* We ran out of memory, or some other thing happened to us that
made us unable to handle the page fault gracefully. */
out_of_memory:
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
}
printk(KERN_ALERT "VM: killing process %s(%d)\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
if (!user_mode(regs))
goto no_context;
do_exit(SIGKILL);
Index: linux-2.6.15-rc1/arch/arm/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm/kernel/process.c
+++ linux-2.6.15-rc1/arch/arm/kernel/process.c
@@ -227,7 +227,7 @@ void __show_regs(struct pt_regs *regs)
void show_regs(struct pt_regs * regs)
{
printk("\n");
- printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
+ printk("Pid: %d, comm: %20s\n", task_pid(current), current->comm);
__show_regs(regs);
__backtrace();
}
Index: linux-2.6.15-rc1/arch/arm/kernel/ptrace.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm/kernel/ptrace.c
+++ linux-2.6.15-rc1/arch/arm/kernel/ptrace.c
@@ -392,7 +392,7 @@ static void clear_breakpoint(struct task
if (ret != 2 || old_insn.thumb != BREAKINST_THUMB)
printk(KERN_ERR "%s:%d: corrupted Thumb breakpoint at "
- "0x%08lx (0x%04x)\n", task->comm, task->pid,
+ "0x%08lx (0x%04x)\n", task->comm, task_pid(task),
addr, old_insn.thumb);
} else {
ret = swap_insn(task, addr & ~3, &old_insn.arm,
@@ -400,7 +400,7 @@ static void clear_breakpoint(struct task
if (ret != 4 || old_insn.arm != BREAKINST_ARM)
printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
- "0x%08lx (0x%08x)\n", task->comm, task->pid,
+ "0x%08lx (0x%08x)\n", task->comm, task_pid(task),
addr, old_insn.arm);
}
}
Index: linux-2.6.15-rc1/arch/arm/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm/kernel/traps.c
+++ linux-2.6.15-rc1/arch/arm/kernel/traps.c
@@ -207,7 +207,7 @@ static void __die(const char *str, int e
print_modules();
__show_regs(regs);
printk("Process %s (pid: %d, stack limit = 0x%p)\n",
- tsk->comm, tsk->pid, thread + 1);
+ tsk->comm, task_pid(tsk), thread + 1);
if (!user_mode(regs) || in_interrupt()) {
dump_mem("Stack: ", regs->ARM_sp,
@@ -306,7 +306,7 @@ asmlinkage void do_undefinstr(struct pt_
#ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_UNDEFINED) {
printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
- current->comm, current->pid, pc);
+ current->comm, task_pid(current), pc);
dump_instr(regs);
}
#endif
@@ -360,7 +360,7 @@ static int bad_syscall(int n, struct pt_
#ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_SYSCALL) {
printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
- current->pid, current->comm, n);
+ task_pid(current), current->comm, n);
dump_instr(regs);
}
#endif
@@ -537,7 +537,7 @@ asmlinkage int arm_syscall(int no, struc
*/
if (user_debug & UDBG_SYSCALL) {
printk("[%d] %s: arm syscall %d\n",
- current->pid, current->comm, no);
+ task_pid(current), current->comm, no);
dump_instr(regs);
if (user_mode(regs)) {
__show_regs(regs);
@@ -614,7 +614,7 @@ baddataabort(int code, unsigned long ins
#ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_BADABORT) {
printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
- current->pid, current->comm, code, instr);
+ task_pid(current), current->comm, code, instr);
dump_instr(regs);
show_pte(current->mm, addr);
}
Index: linux-2.6.15-rc1/arch/arm/mm/alignment.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm/mm/alignment.c
+++ linux-2.6.15-rc1/arch/arm/mm/alignment.c
@@ -759,7 +759,7 @@ do_alignment(unsigned long addr, unsigne
if (ai_usermode & 1)
printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx "
"Address=0x%08lx FSR 0x%03x\n", current->comm,
- current->pid, instrptr,
+ task_pid(current), instrptr,
thumb_mode(regs) ? 4 : 8,
thumb_mode(regs) ? tinstr : instr,
addr, fsr);
Index: linux-2.6.15-rc1/arch/arm/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm/mm/fault.c
+++ linux-2.6.15-rc1/arch/arm/mm/fault.c
@@ -198,7 +198,7 @@ survive:
return fault;
}
- if (tsk->pid != 1)
+ if (task_pid(tsk) != 1)
goto out;
/*
Index: linux-2.6.15-rc1/arch/arm/nwfpe/fpmodule.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm/nwfpe/fpmodule.c
+++ linux-2.6.15-rc1/arch/arm/nwfpe/fpmodule.c
@@ -131,7 +131,7 @@ void float_raise(signed char flags)
if (flags & ~BIT_IXC)
printk(KERN_DEBUG
"NWFPE: %s[%d] takes exception %08x at %p from %08lx\n",
- current->comm, current->pid, flags,
+ current->comm, task_pid(current), flags,
__builtin_return_address(0), GET_USERREG()->ARM_pc);
#endif
Index: linux-2.6.15-rc1/arch/arm26/kernel/ptrace.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm26/kernel/ptrace.c
+++ linux-2.6.15-rc1/arch/arm26/kernel/ptrace.c
@@ -366,7 +366,7 @@ static void clear_breakpoint(struct task
if (ret != 4 || old_insn != BREAKINST_ARM)
printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
- "0x%08lx (0x%08x)\n", task->comm, task->pid,
+ "0x%08lx (0x%08x)\n", task->comm, task_pid(task),
addr, old_insn);
}
Index: linux-2.6.15-rc1/arch/arm26/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm26/kernel/traps.c
+++ linux-2.6.15-rc1/arch/arm26/kernel/traps.c
@@ -187,7 +187,7 @@ NORET_TYPE void die(const char *str, str
printk("CPU: %d\n", smp_processor_id());
show_regs(regs);
printk("Process %s (pid: %d, stack limit = 0x%p)\n",
- current->comm, current->pid, tsk->thread_info + 1);
+ current->comm, task_pid(current), tsk->thread_info + 1);
if (!user_mode(regs) || in_interrupt()) {
__dump_stack(tsk, (unsigned long)(regs + 1));
@@ -276,7 +276,7 @@ asmlinkage void do_undefinstr(struct pt_
#ifdef CONFIG_DEBUG_USER
printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
- current->comm, current->pid, pc);
+ current->comm, task_pid(current), pc);
dump_instr(regs);
#endif
@@ -299,7 +299,7 @@ asmlinkage void do_excpt(unsigned long a
#ifdef CONFIG_DEBUG_USER
printk(KERN_INFO "%s (%d): address exception: pc=%08lx\n",
- current->comm, current->pid, instruction_pointer(regs));
+ current->comm, task_pid(current), instruction_pointer(regs));
dump_instr(regs);
#endif
@@ -363,7 +363,7 @@ static int bad_syscall(int n, struct pt_
#ifdef CONFIG_DEBUG_USER
printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
- current->pid, current->comm, n);
+ task_pid(current), current->comm, n);
dump_instr(regs);
#endif
@@ -442,7 +442,7 @@ asmlinkage int arm_syscall(int no, struc
* experience shows that these seem to indicate that
* something catastrophic has happened
*/
- printk("[%d] %s: arm syscall %d\n", current->pid, current->comm, no);
+ printk("[%d] %s: arm syscall %d\n", task_pid(current), current->comm, no);
dump_instr(regs);
if (user_mode(regs)) {
show_regs(regs);
@@ -478,7 +478,7 @@ baddataabort(int code, unsigned long ins
#ifdef CONFIG_DEBUG_USER
printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
- current->pid, current->comm, code, instr);
+ task_pid(current), current->comm, code, instr);
dump_instr(regs);
show_pte(current->mm, addr);
#endif
Index: linux-2.6.15-rc1/arch/arm26/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm26/mm/fault.c
+++ linux-2.6.15-rc1/arch/arm26/mm/fault.c
@@ -186,7 +186,7 @@ survive:
}
fault = -3; /* out of memory */
- if (tsk->pid != 1)
+ if (task_pid(tsk) != 1)
goto out;
/*
Index: linux-2.6.15-rc1/arch/arm26/nwfpe/fpmodule.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/arm26/nwfpe/fpmodule.c
+++ linux-2.6.15-rc1/arch/arm26/nwfpe/fpmodule.c
@@ -145,7 +145,7 @@ void float_raise(signed char flags)
#ifdef CONFIG_DEBUG_USER
printk(KERN_DEBUG "NWFPE: %s[%d] takes exception %08x at %p from %08x\n",
- current->comm, current->pid, flags,
+ current->comm, task_pid(current), flags,
__builtin_return_address(0), GET_USERREG()[15]);
#endif
Index: linux-2.6.15-rc1/arch/cris/arch-v10/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/cris/arch-v10/kernel/traps.c
+++ linux-2.6.15-rc1/arch/cris/arch-v10/kernel/traps.c
@@ -40,7 +40,7 @@ show_registers(struct pt_regs * regs)
regs->r12, regs->r13, regs->orig_r10, regs);
raw_printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE);
raw_printk("Process %s (pid: %d, stackpage=%08lx)\n",
- current->comm, current->pid, (unsigned long)current);
+ current->comm, task_pid(current), (unsigned long)current);
/*
* When in-kernel, we also print out the stack and code at the
Index: linux-2.6.15-rc1/arch/cris/arch-v32/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/cris/arch-v32/kernel/process.c
+++ linux-2.6.15-rc1/arch/cris/arch-v32/kernel/process.c
@@ -45,7 +45,7 @@ void default_idle(void)
extern void deconfigure_bp(long pid);
void exit_thread(void)
{
- deconfigure_bp(current->pid);
+ deconfigure_bp(task_pid(current));
}
/*
Index: linux-2.6.15-rc1/arch/cris/arch-v32/kernel/ptrace.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/cris/arch-v32/kernel/ptrace.c
+++ linux-2.6.15-rc1/arch/cris/arch-v32/kernel/ptrace.c
@@ -52,7 +52,7 @@ long get_reg(struct task_struct *task, u
else if (regno == PT_PPC)
ret = get_pseudo_pc(task);
else if (regno <= PT_MAX)
- ret = get_debugreg(task->pid, regno);
+ ret = get_debugreg(task_pid(task), regno);
else
ret = 0;
@@ -73,7 +73,7 @@ int put_reg(struct task_struct *task, un
if (data != get_pseudo_pc(task))
((unsigned long *)user_regs(task->thread_info))[PT_ERP] = data;
} else if (regno <= PT_MAX)
- return put_debugreg(task->pid, regno, data);
+ return put_debugreg(task_pid(task), regno, data);
else
return -1;
return 0;
Index: linux-2.6.15-rc1/arch/cris/arch-v32/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/cris/arch-v32/kernel/signal.c
+++ linux-2.6.15-rc1/arch/cris/arch-v32/kernel/signal.c
@@ -648,7 +648,7 @@ ugdb_trap_user(struct thread_info *ti, i
if (!(user_regs(ti)->erp & 0x1))
user_regs(ti)->erp -= 2;
}
- sys_kill(ti->task->pid, sig);
+ sys_kill(ti->task_pid(task), sig);
}
void
Index: linux-2.6.15-rc1/arch/cris/arch-v32/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/cris/arch-v32/kernel/traps.c
+++ linux-2.6.15-rc1/arch/cris/arch-v32/kernel/traps.c
@@ -57,7 +57,7 @@ show_registers(struct pt_regs *regs)
raw_printk("Instruction MMU Cause: %08lx\n", i_mmu_cause);
raw_printk("Process %s (pid: %d, stackpage: %08lx)\n",
- current->comm, current->pid, (unsigned long) current);
+ current->comm, task_pid(current), (unsigned long) current);
/* Show additional info if in kernel-mode. */
if (!user_mode(regs)) {
Index: linux-2.6.15-rc1/arch/cris/kernel/profile.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/cris/kernel/profile.c
+++ linux-2.6.15-rc1/arch/cris/kernel/profile.c
@@ -18,7 +18,7 @@ cris_profile_sample(struct pt_regs* regs
if (!prof_running)
return;
if (user_mode(regs))
- *(unsigned int*)sample_buffer_pos = current->pid;
+ *(unsigned int*)sample_buffer_pos = task_pid(current);
else
*(unsigned int*)sample_buffer_pos = 0;
*(unsigned int*)(sample_buffer_pos + 4) = instruction_pointer(regs);
Index: linux-2.6.15-rc1/arch/frv/kernel/gdb-stub.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/frv/kernel/gdb-stub.c
+++ linux-2.6.15-rc1/arch/frv/kernel/gdb-stub.c
@@ -1182,7 +1182,7 @@ static void __attribute__((unused)) gdbs
printk(" | ");
}
- gdbstub_printk("Process %s (pid: %d)\n", current->comm, current->pid);
+ gdbstub_printk("Process %s (pid: %d)\n", current->comm, task_pid(current));
} /* end gdbstub_show_regs() */
/*****************************************************************************/
Index: linux-2.6.15-rc1/arch/frv/kernel/ptrace.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/frv/kernel/ptrace.c
+++ linux-2.6.15-rc1/arch/frv/kernel/ptrace.c
@@ -639,7 +639,7 @@ asmlinkage void do_syscall_trace(int lea
if (!leaving) {
if (!argmask) {
printk(KERN_CRIT "[%d] %s(%lx,%lx,%lx,%lx,%lx,%lx)\n",
- current->pid,
+ task_pid(current),
name,
__frame->gr8,
__frame->gr9,
@@ -650,12 +650,12 @@ asmlinkage void do_syscall_trace(int lea
}
else if (argmask == 0xffffff) {
printk(KERN_CRIT "[%d] %s()\n",
- current->pid,
+ task_pid(current),
name);
}
else {
printk(KERN_CRIT "[%d] %s(",
- current->pid,
+ task_pid(current),
name);
argp = &__frame->gr8;
@@ -691,9 +691,9 @@ asmlinkage void do_syscall_trace(int lea
}
else {
if ((int)__frame->gr8 > -4096 && (int)__frame->gr8 < 4096)
- printk(KERN_CRIT "[%d] %s() = %ld\n", current->pid, name, __frame->gr8);
+ printk(KERN_CRIT "[%d] %s() = %ld\n", task_pid(current), name, __frame->gr8);
else
- printk(KERN_CRIT "[%d] %s() = %lx\n", current->pid, name, __frame->gr8);
+ printk(KERN_CRIT "[%d] %s() = %lx\n", task_pid(current), name, __frame->gr8);
}
return;
#endif
Index: linux-2.6.15-rc1/arch/frv/kernel/semaphore.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/frv/kernel/semaphore.c
+++ linux-2.6.15-rc1/arch/frv/kernel/semaphore.c
@@ -25,7 +25,7 @@ void semtrace(struct semaphore *sem, con
{
if (sem->debug)
printk("[%d] %s({%d,%d})\n",
- current->pid,
+ task_pid(current),
str,
sem->counter,
list_empty(&sem->wait_list) ? 0 : 1);
Index: linux-2.6.15-rc1/arch/frv/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/frv/kernel/signal.c
+++ linux-2.6.15-rc1/arch/frv/kernel/signal.c
@@ -364,7 +364,7 @@ static void setup_frame(int sig, struct
#if DEBUG_SIG
printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n",
- sig, current->comm, current->pid, frame, regs->pc, frame->pretcode);
+ sig, current->comm, task_pid(current), frame, regs->pc, frame->pretcode);
#endif
return;
@@ -459,7 +459,7 @@ static void setup_rt_frame(int sig, stru
#if DEBUG_SIG
printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n",
- sig, current->comm, current->pid, frame, regs->pc, frame->pretcode);
+ sig, current->comm, task_pid(current), frame, regs->pc, frame->pretcode);
#endif
return;
Index: linux-2.6.15-rc1/arch/frv/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/frv/kernel/traps.c
+++ linux-2.6.15-rc1/arch/frv/kernel/traps.c
@@ -296,7 +296,7 @@ void show_regs(struct pt_regs *regs)
printk(" | ");
}
- printk("Process %s (pid: %d)\n", current->comm, current->pid);
+ printk("Process %s (pid: %d)\n", current->comm, task_pid(current));
}
void die_if_kernel(const char *str, ...)
@@ -365,7 +365,7 @@ void show_backtrace(struct pt_regs *fram
stop = (unsigned long) frame;
}
- printk("\nProcess %s (pid: %d)\n\n", current->comm, current->pid);
+ printk("\nProcess %s (pid: %d)\n\n", current->comm, task_pid(current));
for (;;) {
/* dump stack segment between frames */
Index: linux-2.6.15-rc1/arch/frv/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/frv/mm/fault.c
+++ linux-2.6.15-rc1/arch/frv/mm/fault.c
@@ -101,10 +101,10 @@ asmlinkage void do_page_fault(int datamm
if ((ear0 & PAGE_MASK) + 2 * PAGE_SIZE < __frame->sp) {
#if 0
printk("[%d] ### Access below stack @%lx (sp=%lx)\n",
- current->pid, ear0, __frame->sp);
+ task_pid(current), ear0, __frame->sp);
show_registers(__frame);
printk("[%d] ### Code: [%08lx] %02x %02x %02x %02x %02x %02x %02x %02x\n",
- current->pid,
+ task_pid(current),
__frame->pc,
((u8*)__frame->pc)[0],
((u8*)__frame->pc)[1],
Index: linux-2.6.15-rc1/arch/h8300/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/h8300/kernel/traps.c
+++ linux-2.6.15-rc1/arch/h8300/kernel/traps.c
@@ -56,7 +56,7 @@ static void dump(struct pt_regs *fp)
int i;
printk("\nCURRENT PROCESS:\n\n");
- printk("COMM=%s PID=%d\n", current->comm, current->pid);
+ printk("COMM=%s PID=%d\n", current->comm, task_pid(current));
if (current->mm) {
printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
(int) current->mm->start_code,
Index: linux-2.6.15-rc1/arch/m32r/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m32r/kernel/process.c
+++ linux-2.6.15-rc1/arch/m32r/kernel/process.c
@@ -214,19 +214,19 @@ int kernel_thread(int (*fn)(void *), voi
void exit_thread(void)
{
/* Nothing to do. */
- DPRINTK("pid = %d\n", current->pid);
+ DPRINTK("pid = %d\n", task_pid(current));
}
void flush_thread(void)
{
- DPRINTK("pid = %d\n", current->pid);
+ DPRINTK("pid = %d\n", task_pid(current));
memset(¤t->thread.debug_trap, 0, sizeof(struct debug_trap));
}
void release_thread(struct task_struct *dead_task)
{
/* do nothing */
- DPRINTK("pid = %d\n", dead_task->pid);
+ DPRINTK("pid = %d\n", dead_task_pid(task));
}
/* Fill in the fpu structure for a core dump.. */
@@ -249,7 +249,7 @@ int copy_thread(int nr, unsigned long cl
childregs->spu = spu;
childregs->r0 = 0; /* Child gets zero as return value */
- regs->r0 = tsk->pid;
+ regs->r0 = task_pid(tsk);
tsk->thread.sp = (unsigned long)childregs;
tsk->thread.lr = (unsigned long)ret_from_fork;
Index: linux-2.6.15-rc1/arch/m32r/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m32r/kernel/signal.c
+++ linux-2.6.15-rc1/arch/m32r/kernel/signal.c
@@ -294,7 +294,7 @@ static void setup_rt_frame(int sig, stru
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p\n",
- current->comm, current->pid, frame, regs->pc);
+ current->comm, task_pid(current), frame, regs->pc);
#endif
return;
Index: linux-2.6.15-rc1/arch/m32r/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m32r/kernel/traps.c
+++ linux-2.6.15-rc1/arch/m32r/kernel/traps.c
@@ -197,7 +197,7 @@ static void show_registers(struct pt_reg
printk("SPI: %08lx\n", sp);
}
printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)",
- current->comm, current->pid, 0xffff & i, 4096+(unsigned long)current);
+ current->comm, task_pid(current), 0xffff & i, 4096+(unsigned long)current);
/*
* When in-kernel, we also print out the stack and code at the
Index: linux-2.6.15-rc1/arch/m32r/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m32r/mm/fault.c
+++ linux-2.6.15-rc1/arch/m32r/mm/fault.c
@@ -300,7 +300,7 @@ no_context:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (tsk->pid == 1) {
+ if (task_pid(tsk) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/m68k/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m68k/kernel/traps.c
+++ linux-2.6.15-rc1/arch/m68k/kernel/traps.c
@@ -673,7 +673,7 @@ static inline void bus_error030 (struct
#ifdef DEBUG
unsigned long desc;
- printk ("pid = %x ", current->pid);
+ printk ("pid = %x ", task_pid(current));
printk ("SSW=%#06x ", ssw);
if (ssw & (FC | FB))
@@ -1057,7 +1057,7 @@ void bad_super_trap (struct frame *fp)
fp->un.fmtb.daddr, space_names[ssw & DFC],
fp->ptregs.pc);
}
- printk ("Current process id is %d\n", current->pid);
+ printk ("Current process id is %d\n", task_pid(current));
die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
}
@@ -1199,7 +1199,7 @@ void die_if_kernel (char *str, struct pt
fp->d4, fp->d5, fp->a0, fp->a1);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
- current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
+ current->comm, task_pid(current), PAGE_SIZE+(unsigned long)current);
show_stack(NULL, (unsigned long *)fp);
do_exit(SIGSEGV);
}
Index: linux-2.6.15-rc1/arch/m68k/mac/macints.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m68k/mac/macints.c
+++ linux-2.6.15-rc1/arch/m68k/mac/macints.c
@@ -696,7 +696,7 @@ irqreturn_t mac_nmi_handler(int irq, voi
if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
printk("Corrupted stack page\n");
printk("Process %s (pid: %d, stackpage=%08lx)\n",
- current->comm, current->pid, current->kernel_stack_page);
+ current->comm, task_pid(current), current->kernel_stack_page);
if (intr_count == 1)
dump_stack((struct frame *)fp);
#else
Index: linux-2.6.15-rc1/arch/m68k/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m68k/mm/fault.c
+++ linux-2.6.15-rc1/arch/m68k/mm/fault.c
@@ -181,7 +181,7 @@ good_area:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/m68knommu/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m68knommu/kernel/process.c
+++ linux-2.6.15-rc1/arch/m68knommu/kernel/process.c
@@ -331,7 +331,7 @@ void dump(struct pt_regs *fp)
int i;
printk(KERN_EMERG "\nCURRENT PROCESS:\n\n");
- printk(KERN_EMERG "COMM=%s PID=%d\n", current->comm, current->pid);
+ printk(KERN_EMERG "COMM=%s PID=%d\n", current->comm, task_pid(current));
if (current->mm) {
printk(KERN_EMERG "TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
Index: linux-2.6.15-rc1/arch/m68knommu/kernel/time.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m68knommu/kernel/time.c
+++ linux-2.6.15-rc1/arch/m68knommu/kernel/time.c
@@ -56,7 +56,7 @@ static irqreturn_t timer_interrupt(int i
#ifndef CONFIG_SMP
update_process_times(user_mode(regs));
#endif
- if (current->pid)
+ if (task_pid(current))
profile_tick(CPU_PROFILING, regs);
/*
Index: linux-2.6.15-rc1/arch/m68knommu/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m68knommu/kernel/traps.c
+++ linux-2.6.15-rc1/arch/m68knommu/kernel/traps.c
@@ -82,7 +82,7 @@ void die_if_kernel(char *str, struct pt_
fp->d4, fp->d5, fp->a0, fp->a1);
printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
- current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
+ current->comm, task_pid(current), PAGE_SIZE+(unsigned long)current);
show_stack(NULL, (unsigned long *)fp);
do_exit(SIGSEGV);
}
@@ -166,7 +166,7 @@ void bad_super_trap(struct frame *fp)
printk (KERN_WARNING "*** Exception %d *** FORMAT=%X\n",
(fp->ptregs.vector) >> 2,
fp->ptregs.format);
- printk (KERN_WARNING "Current process id is %d\n", current->pid);
+ printk (KERN_WARNING "Current process id is %d\n", task_pid(current));
die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
}
Index: linux-2.6.15-rc1/arch/m68knommu/platform/5307/timers.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/m68knommu/platform/5307/timers.c
+++ linux-2.6.15-rc1/arch/m68knommu/platform/5307/timers.c
@@ -110,7 +110,7 @@ void coldfire_profile_tick(int irq, void
{
/* Reset ColdFire timer2 */
mcf_proftp->ter = MCFTIMER_TER_CAP | MCFTIMER_TER_REF;
- if (current->pid)
+ if (task_pid(current))
profile_tick(CPU_PROFILING, regs);
}
Index: linux-2.6.15-rc1/arch/parisc/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/parisc/kernel/signal.c
+++ linux-2.6.15-rc1/arch/parisc/kernel/signal.c
@@ -228,7 +228,7 @@ give_sigsegv:
si.si_signo = SIGSEGV;
si.si_errno = 0;
si.si_code = SI_KERNEL;
- si.si_pid = current->pid;
+ si.si_pid = task_pid(current);
si.si_uid = current->uid;
si.si_addr = &frame->uc;
force_sig_info(SIGSEGV, &si, current);
@@ -483,7 +483,7 @@ setup_rt_frame(int sig, struct k_sigacti
DBG(1,"setup_rt_frame: sig deliver (%s,%d) frame=0x%p sp=%#lx iaoq=%#lx/%#lx rp=%#lx\n",
- current->comm, current->pid, frame, regs->gr[30],
+ current->comm, task_pid(current), frame, regs->gr[30],
regs->iaoq[0], regs->iaoq[1], rp);
return 1;
Index: linux-2.6.15-rc1/arch/parisc/kernel/smp.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/parisc/kernel/smp.c
+++ linux-2.6.15-rc1/arch/parisc/kernel/smp.c
@@ -680,7 +680,8 @@ int sys_cpus(int argc, char **argv)
}
#else
printk("\n%s %4d 0 0 --------",
- (current->pid)?"RUNNING ": "IDLING ",current->pid);
+ (task_pid(current))?"RUNNING ": "IDLING ",
+ task_pid(current));
#endif
} else if ((argc==2) && !(strcmp(argv[1],"-s"))) {
#ifdef DUMP_MORE_STATE
@@ -705,7 +706,7 @@ int sys_cpus(int argc, char **argv)
}
}
#else
- printk("\n%s CPU0",(current->pid==0)?"RUNNING ":"IDLING ");
+ printk("\n%s CPU0",(task_pid(current)==0)?"RUNNING ":"IDLING ");
#endif
} else {
printk("sys_cpus:Unknown request\n");
Index: linux-2.6.15-rc1/arch/parisc/kernel/sys_parisc32.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/parisc/kernel/sys_parisc32.c
+++ linux-2.6.15-rc1/arch/parisc/kernel/sys_parisc32.c
@@ -95,7 +95,7 @@ asmlinkage long sys32_unimplemented(int
int r22, int r21, int r20)
{
printk(KERN_ERR "%s(%d): Unimplemented 32 on 64 syscall #%d!\n",
- current->comm, current->pid, r20);
+ current->comm, task_pid(current), r20);
return -ENOSYS;
}
Index: linux-2.6.15-rc1/arch/parisc/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/parisc/kernel/traps.c
+++ linux-2.6.15-rc1/arch/parisc/kernel/traps.c
@@ -216,7 +216,7 @@ void die_if_kernel(char *str, struct pt_
return; /* STFU */
printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
- current->comm, current->pid, str, err, regs->iaoq[0]);
+ current->comm, task_pid(current), str, err, regs->iaoq[0]);
#ifdef PRINT_USER_FAULTS
/* XXX for debugging only */
show_regs(regs);
@@ -248,7 +248,7 @@ void die_if_kernel(char *str, struct pt_
pdc_console_restart();
printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
- current->comm, current->pid, str, err);
+ current->comm, task_pid(current), str, err);
show_regs(regs);
/* Wot's wrong wif bein' racy? */
@@ -288,7 +288,7 @@ void handle_break(unsigned iir, struct p
case 0x00:
#ifdef PRINT_USER_FAULTS
printk(KERN_DEBUG "break 0,0: pid=%d command='%s'\n",
- current->pid, current->comm);
+ task_pid(current), current->comm);
#endif
die_if_kernel("Breakpoint", regs, 0);
#ifdef PRINT_USER_FAULTS
@@ -308,7 +308,7 @@ void handle_break(unsigned iir, struct p
default:
#ifdef PRINT_USER_FAULTS
printk(KERN_DEBUG "break %#08x: pid=%d command='%s'\n",
- iir, current->pid, current->comm);
+ iir, task_pid(current), current->comm);
show_regs(regs);
#endif
si.si_signo = SIGTRAP;
@@ -746,7 +746,7 @@ void handle_interruption(int code, struc
if (user_mode(regs)) {
#ifdef PRINT_USER_FAULTS
printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n",
- current->pid, current->comm);
+ task_pid(current), current->comm);
show_regs(regs);
#endif
/* SIGBUS, for lack of a better one. */
@@ -771,7 +771,7 @@ void handle_interruption(int code, struc
else
printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ",
code);
- printk("pid=%d command='%s'\n", current->pid, current->comm);
+ printk("pid=%d command='%s'\n", task_pid(current), current->comm);
show_regs(regs);
#endif
si.si_signo = SIGSEGV;
Index: linux-2.6.15-rc1/arch/parisc/kernel/unaligned.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/parisc/kernel/unaligned.c
+++ linux-2.6.15-rc1/arch/parisc/kernel/unaligned.c
@@ -527,7 +527,7 @@ void handle_unaligned(struct pt_regs *re
&& ++unaligned_count < 5) {
char buf[256];
sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n",
- current->comm, current->pid, regs->ior, regs->iaoq[0]);
+ current->comm, task_pid(current), regs->ior, regs->iaoq[0]);
printk(KERN_WARNING "%s", buf);
#ifdef DEBUG_UNALIGNED
show_regs(regs);
Index: linux-2.6.15-rc1/arch/parisc/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/parisc/mm/fault.c
+++ linux-2.6.15-rc1/arch/parisc/mm/fault.c
@@ -214,7 +214,7 @@ bad_area:
#ifdef PRINT_USER_FAULTS
printk(KERN_DEBUG "\n");
printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
- tsk->pid, tsk->comm, code, address);
+ task_pid(tsk), tsk->comm, code, address);
if (vma) {
printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
vma->vm_start, vma->vm_end);
Index: linux-2.6.15-rc1/arch/ppc/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ppc/kernel/process.c
+++ linux-2.6.15-rc1/arch/ppc/kernel/process.c
@@ -112,7 +112,7 @@ int check_stack(struct task_struct *tsk)
{
printk("stack out of bounds: %s/%d\n"
" tsk_top %08lx ksp %08lx stack_top %08lx\n",
- tsk->comm,tsk->pid,
+ tsk->comm,task_pid(tsk),
tsk_top, tsk->thread.ksp, stack_top);
ret |= 2;
}
@@ -122,7 +122,7 @@ int check_stack(struct task_struct *tsk)
{
printk("current stack ptr out of bounds: %s/%d\n"
" tsk_top %08lx sp %08lx stack_top %08lx\n",
- current->comm,current->pid,
+ current->comm,task_pid(current),
tsk_top, _get_SP(), stack_top);
ret |= 4;
}
@@ -384,7 +384,7 @@ void show_regs(struct pt_regs * regs)
if (trap == 0x300 || trap == 0x600)
printk("DAR: %08lX, DSISR: %08lX\n", regs->dar, regs->dsisr);
printk("TASK = %p[%d] '%s' THREAD: %p\n",
- current, current->pid, current->comm, current->thread_info);
+ current, task_pid(current), current->comm, current->thread_info);
printk("Last syscall: %ld ", current->thread.last_syscall);
#ifdef CONFIG_SMP
Index: linux-2.6.15-rc1/arch/ppc/kernel/softemu8xx.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ppc/kernel/softemu8xx.c
+++ linux-2.6.15-rc1/arch/ppc/kernel/softemu8xx.c
@@ -120,7 +120,7 @@ Soft_emulate_8xx(struct pt_regs *regs)
printk("Bad emulation %s/%d\n"
" NIP: %08lx instruction: %08x opcode: %x "
"A: %x B: %x C: %x code: %x rc: %x\n",
- current->comm,current->pid,
+ current->comm,task_pid(current),
regs->nip,
instword,inst,
(instword>>16)&0x1f,
Index: linux-2.6.15-rc1/arch/ppc/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ppc/kernel/traps.c
+++ linux-2.6.15-rc1/arch/ppc/kernel/traps.c
@@ -131,7 +131,7 @@ void _exception(int signr, struct pt_reg
* generate the same exception over and over again and we get
* nowhere. Better to kill it and let the kernel panic.
*/
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
__sighandler_t handler;
spin_lock_irq(¤t->sighand->siglock);
@@ -759,7 +759,7 @@ void nonrecoverable_exception(struct pt_
void trace_syscall(struct pt_regs *regs)
{
printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
- current, current->pid, regs->nip, regs->link, regs->gpr[0],
+ current, task_pid(current), regs->nip, regs->link, regs->gpr[0],
regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
}
Index: linux-2.6.15-rc1/arch/ppc/lib/locks.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ppc/lib/locks.c
+++ linux-2.6.15-rc1/arch/ppc/lib/locks.c
@@ -80,7 +80,7 @@ void _raw_spin_unlock(spinlock_t *lp)
if ( !lp->lock )
printk("_spin_unlock(%p): no lock cpu %d curr PC %p %s/%d\n",
lp, smp_processor_id(), __builtin_return_address(0),
- current->comm, current->pid);
+ current->comm, task_pid(current));
if ( lp->owner_cpu != smp_processor_id() )
printk("_spin_unlock(%p): cpu %d trying clear of cpu %d pc %lx val %lx\n",
lp, smp_processor_id(), (int)lp->owner_cpu,
@@ -142,7 +142,7 @@ void _raw_read_unlock(rwlock_t *rw)
{
if ( rw->lock == 0 )
printk("_read_unlock(): %s/%d (nip %08lX) lock %d\n",
- current->comm,current->pid,current->thread.regs->nip,
+ current->comm,task_pid(current),current->thread.regs->nip,
rw->lock);
wmb();
atomic_dec((atomic_t *) &(rw)->lock);
@@ -180,7 +180,7 @@ void _raw_write_unlock(rwlock_t *rw)
{
if (rw->lock >= 0)
printk("_write_lock(): %s/%d (nip %08lX) lock %d\n",
- current->comm,current->pid,current->thread.regs->nip,
+ current->comm,task_pid(current),current->thread.regs->nip,
rw->lock);
wmb();
rw->lock = 0;
Index: linux-2.6.15-rc1/arch/ppc/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ppc/mm/fault.c
+++ linux-2.6.15-rc1/arch/ppc/mm/fault.c
@@ -290,7 +290,7 @@ bad_area:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/ppc/xmon/xmon.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ppc/xmon/xmon.c
+++ linux-2.6.15-rc1/arch/ppc/xmon/xmon.c
@@ -895,7 +895,7 @@ excprint(struct pt_regs *fp)
printf("dar = %x, dsisr = %x\n", fp->dar, fp->dsisr);
if (current)
printf("current = %x, pid = %d, comm = %s\n",
- current, current->pid, current->comm);
+ current, task_pid(current), current->comm);
}
void
Index: linux-2.6.15-rc1/arch/s390/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/s390/kernel/process.c
+++ linux-2.6.15-rc1/arch/s390/kernel/process.c
@@ -155,7 +155,7 @@ void show_regs(struct pt_regs *regs)
printk("CPU: %d %s\n", tsk->thread_info->cpu, print_tainted());
printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
- current->comm, current->pid, (void *) tsk,
+ current->comm, task_pid(current), (void *) tsk,
(void *) tsk->thread.ksp);
show_registers(regs);
Index: linux-2.6.15-rc1/arch/s390/math-emu/math.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/s390/math-emu/math.c
+++ linux-2.6.15-rc1/arch/s390/math-emu/math.c
@@ -108,7 +108,7 @@ static void display_emulation_not_implem
location = (__u16 *)(regs->psw.addr-S390_lowcore.pgm_ilc);
printk("%s ieee fpu instruction not emulated "
"process name: %s pid: %d \n",
- instr, current->comm, current->pid);
+ instr, current->comm, task_pid(current));
printk("%s's PSW: %08lx %08lx\n", instr,
(unsigned long) regs->psw.mask,
(unsigned long) location);
Index: linux-2.6.15-rc1/arch/s390/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/s390/mm/fault.c
+++ linux-2.6.15-rc1/arch/s390/mm/fault.c
@@ -316,7 +316,7 @@ no_context:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (tsk->pid == 1) {
+ if (task_pid(tsk) == 1) {
yield();
goto survive;
}
Index: linux-2.6.15-rc1/arch/sh/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh/kernel/process.c
+++ linux-2.6.15-rc1/arch/sh/kernel/process.c
@@ -105,7 +105,7 @@ void machine_power_off(void)
void show_regs(struct pt_regs * regs)
{
printk("\n");
- printk("Pid : %d, Comm: %20s\n", current->pid, current->comm);
+ printk("Pid : %d, Comm: %20s\n", task_pid(current), current->comm);
print_symbol("PC is at %s\n", regs->pc);
printk("PC : %08lx SP : %08lx SR : %08lx ",
regs->pc, regs->regs[15], regs->sr);
Index: linux-2.6.15-rc1/arch/sh/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh/kernel/signal.c
+++ linux-2.6.15-rc1/arch/sh/kernel/signal.c
@@ -404,7 +404,7 @@ static void setup_frame(int sig, struct
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
- current->comm, current->pid, frame, regs->pc, regs->pr);
+ current->comm, task_pid(current), frame, regs->pc, regs->pr);
#endif
flush_cache_sigtramp(regs->pr);
@@ -479,7 +479,7 @@ static void setup_rt_frame(int sig, stru
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
- current->comm, current->pid, frame, regs->pc, regs->pr);
+ current->comm, task_pid(current), frame, regs->pc, regs->pr);
#endif
flush_cache_sigtramp(regs->pr);
Index: linux-2.6.15-rc1/arch/sh/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh/kernel/traps.c
+++ linux-2.6.15-rc1/arch/sh/kernel/traps.c
@@ -362,7 +362,7 @@ static int handle_unaligned_access(u16 i
handle_unaligned_notify_count--;
printk("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
- current->comm,current->pid,(u16*)regs->pc,instruction);
+ current->comm,task_pid(current),(u16*)regs->pc,instruction);
}
ret = -EFAULT;
Index: linux-2.6.15-rc1/arch/sh/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh/mm/fault.c
+++ linux-2.6.15-rc1/arch/sh/mm/fault.c
@@ -160,7 +160,7 @@ no_context:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/sh64/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh64/kernel/process.c
+++ linux-2.6.15-rc1/arch/sh64/kernel/process.c
@@ -927,7 +927,7 @@ asids_proc_info(char *buf, char **start,
struct task_struct *p;
read_lock(&tasklist_lock);
for_each_process(p) {
- int pid = p->pid;
+ int pid = task_pid(p);
struct mm_struct *mm;
if (!pid) continue;
mm = p->mm;
Index: linux-2.6.15-rc1/arch/sh64/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh64/kernel/signal.c
+++ linux-2.6.15-rc1/arch/sh64/kernel/signal.c
@@ -512,7 +512,7 @@ static void setup_frame(int sig, struct
/* Broken %016Lx */
printk("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n",
signal,
- current->comm, current->pid, frame,
+ current->comm, task_pid(current), frame,
regs->pc >> 32, regs->pc & 0xffffffff,
DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
#endif
@@ -618,7 +618,7 @@ static void setup_rt_frame(int sig, stru
/* Broken %016Lx */
printk("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n",
signal,
- current->comm, current->pid, frame,
+ current->comm, task_pid(current), frame,
regs->pc >> 32, regs->pc & 0xffffffff,
DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
#endif
Index: linux-2.6.15-rc1/arch/sh64/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh64/kernel/traps.c
+++ linux-2.6.15-rc1/arch/sh64/kernel/traps.c
@@ -765,7 +765,7 @@ static int misaligned_fixup(struct pt_re
--user_mode_unaligned_fixup_count;
/* Only do 'count' worth of these reports, to remove a potential DoS against syslog */
printk("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n",
- current->comm, current->pid, (__u32)regs->pc, opcode);
+ current->comm, task_pid(current), (__u32)regs->pc, opcode);
} else
#endif
if (!user_mode(regs) && (kernel_mode_unaligned_fixup_count > 0)) {
@@ -775,7 +775,7 @@ static int misaligned_fixup(struct pt_re
(__u32)regs->pc, opcode);
} else {
printk("Fixing up unaligned kernelspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n",
- current->comm, current->pid, (__u32)regs->pc, opcode);
+ current->comm, task_pid(current), (__u32)regs->pc, opcode);
}
}
Index: linux-2.6.15-rc1/arch/sh64/lib/dbg.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh64/lib/dbg.c
+++ linux-2.6.15-rc1/arch/sh64/lib/dbg.c
@@ -173,7 +173,7 @@ void evt_debug(int evt, int ret_addr, in
int pid;
struct ring_node *rr;
- pid = current->pid;
+ pid = task_pid(current);
stack_bottom = (unsigned long) current->thread_info;
asm volatile("ori r15, 0, %0" : "=r" (sp));
rr = event_ring + event_ptr;
@@ -209,7 +209,7 @@ void evt_debug(int evt, int ret_addr, in
*
* Just overwrite old entries on ring overflow - this
* is only for last-hope debugging. */
- stored_syscalls[syscall_next].pid = current->pid;
+ stored_syscalls[syscall_next].pid = task_pid(current);
stored_syscalls[syscall_next].syscall_number = syscallno;
syscall_next++;
syscall_next &= (N_STORED_SYSCALLS - 1);
@@ -230,7 +230,7 @@ static void drain_syscalls(void) {
void evt_debug2(unsigned int ret)
{
drain_syscalls();
- printk("Task %d: syscall returns %08x\n", current->pid, ret);
+ printk("Task %d: syscall returns %08x\n", task_pid(current), ret);
}
void evt_debug_ret_from_irq(struct pt_regs *regs)
@@ -238,7 +238,7 @@ void evt_debug_ret_from_irq(struct pt_re
int pid;
struct ring_node *rr;
- pid = current->pid;
+ pid = task_pid(current);
rr = event_ring + event_ptr;
rr->evt = 0xffff;
rr->ret_addr = 0;
@@ -254,7 +254,7 @@ void evt_debug_ret_from_exc(struct pt_re
int pid;
struct ring_node *rr;
- pid = current->pid;
+ pid = task_pid(current);
rr = event_ring + event_ptr;
rr->evt = 0xfffe;
rr->ret_addr = 0;
@@ -276,7 +276,7 @@ void show_excp_regs(char *from, int trap
printk("\n");
printk("EXCEPTION - %s: task %d; Linux trap # %d; signal = %d\n",
- ((from) ? from : "???"), current->pid, trapnr, signr);
+ ((from) ? from : "???"), task_pid(current), trapnr, signr);
asm volatile ("getcon " __EXPEVT ", %0":"=r"(ah));
asm volatile ("getcon " __EXPEVT ", %0":"=r"(al));
Index: linux-2.6.15-rc1/arch/sh64/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sh64/mm/fault.c
+++ linux-2.6.15-rc1/arch/sh64/mm/fault.c
@@ -82,7 +82,7 @@ static inline void print_vma(struct vm_a
static inline void print_task(struct task_struct *tsk)
{
- printk("Task pid %d\n", tsk->pid);
+ printk("Task pid %d\n", task_pid(tsk));
}
static pte_t *lookup_pte(struct mm_struct *mm, unsigned long address)
@@ -271,13 +271,13 @@ bad_area:
* usermode, so only need a few */
count++;
printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n",
- address, current->pid, current->comm,
+ address, task_pid(current), current->comm,
(unsigned long) regs->pc);
#if 0
show_regs(regs);
#endif
}
- if (tsk->pid == 1) {
+ if (task_pid(tsk) == 1) {
panic("INIT had user mode bad_area\n");
}
tsk->thread.address = address;
@@ -319,14 +319,14 @@ no_context:
* us unable to handle the page fault gracefully.
*/
out_of_memory:
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
panic("INIT out of memory\n");
yield();
goto survive;
}
printk("fault:Out of memory\n");
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/sparc/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc/kernel/process.c
+++ linux-2.6.15-rc1/arch/sparc/kernel/process.c
@@ -554,7 +554,7 @@ int copy_thread(int nr, unsigned long cl
#endif
/* Set the return value for the child. */
- childregs->u_regs[UREG_I0] = current->pid;
+ childregs->u_regs[UREG_I0] = task_pid(current);
childregs->u_regs[UREG_I1] = 1;
/* Set the return value for the parent. */
Index: linux-2.6.15-rc1/arch/sparc/kernel/ptrace.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc/kernel/ptrace.c
+++ linux-2.6.15-rc1/arch/sparc/kernel/ptrace.c
@@ -155,7 +155,7 @@ static inline void read_sunos_user(struc
/* Rest of them are completely unsupported. */
default:
printk("%s [%d]: Wants to read user offset %ld\n",
- current->comm, current->pid, offset);
+ current->comm, task_pid(current), offset);
pt_error_return(regs, EIO);
return;
}
@@ -222,7 +222,7 @@ static inline void write_sunos_user(stru
/* Rest of them are completely unsupported or "no-touch". */
default:
printk("%s [%d]: Wants to write user offset %ld\n",
- current->comm, current->pid, offset);
+ current->comm, task_pid(current), offset);
goto failure;
}
success:
@@ -596,7 +596,7 @@ out:
asmlinkage void syscall_trace(void)
{
#ifdef DEBUG_PTRACE
- printk("%s [%d]: syscall_trace\n", current->comm, current->pid);
+ printk("%s [%d]: syscall_trace\n", current->comm, task_pid(current));
#endif
if (!test_thread_flag(TIF_SYSCALL_TRACE))
return;
@@ -612,7 +612,7 @@ asmlinkage void syscall_trace(void)
*/
#ifdef DEBUG_PTRACE
printk("%s [%d]: syscall_trace exit= %x\n", current->comm,
- current->pid, current->exit_code);
+ task_pid(current), current->exit_code);
#endif
if (current->exit_code) {
send_sig (current->exit_code, current, 1);
Index: linux-2.6.15-rc1/arch/sparc/kernel/setup.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc/kernel/setup.c
+++ linux-2.6.15-rc1/arch/sparc/kernel/setup.c
@@ -85,7 +85,7 @@ void prom_sync_me(void)
prom_palette(1);
prom_printf("PROM SYNC COMMAND...\n");
show_free_areas();
- if(current->pid != 0) {
+ if(task_pid(current) != 0) {
local_irq_enable();
sys_sync();
local_irq_disable();
Index: linux-2.6.15-rc1/arch/sparc/kernel/sys_sparc.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc/kernel/sys_sparc.c
+++ linux-2.6.15-rc1/arch/sparc/kernel/sys_sparc.c
@@ -353,7 +353,7 @@ c_sys_nis_syscall (struct pt_regs *regs)
if (count++ > 5)
return -ENOSYS;
printk ("%s[%d]: Unimplemented SPARC system call %d\n",
- current->comm, current->pid, (int)regs->u_regs[1]);
+ current->comm, task_pid(current), (int)regs->u_regs[1]);
#ifdef DEBUG_UNIMP_SYSCALL
show_regs (regs);
#endif
Index: linux-2.6.15-rc1/arch/sparc/kernel/sys_sunos.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc/kernel/sys_sunos.c
+++ linux-2.6.15-rc1/arch/sparc/kernel/sys_sunos.c
@@ -825,7 +825,7 @@ asmlinkage int sunos_setpgrp(pid_t pid,
int ret;
/* So stupid... */
- if ((!pid || pid == current->pid) &&
+ if ((!pid || pid == task_pid(current)) &&
!pgid) {
sys_setsid();
ret = 0;
Index: linux-2.6.15-rc1/arch/sparc/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc/kernel/traps.c
+++ linux-2.6.15-rc1/arch/sparc/kernel/traps.c
@@ -39,7 +39,7 @@ struct trap_trace_entry trapbuf[1024];
void syscall_trace_entry(struct pt_regs *regs)
{
- printk("%s[%d]: ", current->comm, current->pid);
+ printk("%s[%d]: ", current->comm, task_pid(current));
printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1],
(int) regs->u_regs[UREG_I0]);
}
@@ -100,7 +100,7 @@ void die_if_kernel(char *str, struct pt_
" /_| \\__/ |_\\\n"
" \\__U_/\n");
- printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter);
+ printk("%s(%d): %s [#%d]\n", current->comm, task_pid(current), str, ++die_counter);
show_regs(regs);
__SAVE; __SAVE; __SAVE; __SAVE;
Index: linux-2.6.15-rc1/arch/sparc/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc/mm/fault.c
+++ linux-2.6.15-rc1/arch/sparc/mm/fault.c
@@ -318,7 +318,7 @@ bad_area_nosemaphore:
if(from_user) {
#if 0
printk("Fault whee %s [%d]: segfaults at %08lx pc=%08lx\n",
- tsk->comm, tsk->pid, address, regs->pc);
+ tsk->comm, task_pid(tsk), address, regs->pc);
#endif
info.si_signo = SIGSEGV;
info.si_errno = 0;
@@ -512,7 +512,7 @@ inline void force_user_fault(unsigned lo
#if 0
printk("wf<pid=%d,wr=%d,addr=%08lx>\n",
- tsk->pid, write, address);
+ task_pid(tsk), write, address);
#endif
down_read(&mm->mmap_sem);
vma = find_vma(mm, address);
@@ -544,7 +544,7 @@ bad_area:
up_read(&mm->mmap_sem);
#if 0
printk("Window whee %s [%d]: segfaults at %08lx\n",
- tsk->comm, tsk->pid, address);
+ tsk->comm, task_pid(tsk), address);
#endif
info.si_signo = SIGSEGV;
info.si_errno = 0;
Index: linux-2.6.15-rc1/arch/sparc64/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc64/kernel/process.c
+++ linux-2.6.15-rc1/arch/sparc64/kernel/process.c
@@ -669,7 +669,7 @@ int copy_thread(int nr, unsigned long cl
}
/* Set the return value for the child. */
- t->kregs->u_regs[UREG_I0] = current->pid;
+ t->kregs->u_regs[UREG_I0] = task_pid(current);
t->kregs->u_regs[UREG_I1] = 1;
/* Set the second return value for the parent. */
Index: linux-2.6.15-rc1/arch/sparc64/kernel/setup.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc64/kernel/setup.c
+++ linux-2.6.15-rc1/arch/sparc64/kernel/setup.c
@@ -129,7 +129,7 @@ int prom_callback(long *args)
if (!strcmp(cmd, "sync")) {
prom_printf("PROM `%s' command...\n", cmd);
show_free_areas();
- if (current->pid != 0) {
+ if (task_pid(current) != 0) {
local_irq_enable();
sys_sync();
local_irq_disable();
Index: linux-2.6.15-rc1/arch/sparc64/kernel/sys_sunos32.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc64/kernel/sys_sunos32.c
+++ linux-2.6.15-rc1/arch/sparc64/kernel/sys_sunos32.c
@@ -791,7 +791,7 @@ asmlinkage int sunos_setpgrp(pid_t pid,
int ret;
/* So stupid... */
- if ((!pid || pid == current->pid) &&
+ if ((!pid || pid == task_pid(current)) &&
!pgid) {
sys_setsid();
ret = 0;
Index: linux-2.6.15-rc1/arch/sparc64/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc64/kernel/traps.c
+++ linux-2.6.15-rc1/arch/sparc64/kernel/traps.c
@@ -1896,7 +1896,7 @@ void die_if_kernel(char *str, struct pt_
" /_| \\__/ |_\\\n"
" \\__U_/\n");
- printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter);
+ printk("%s(%d): %s [#%d]\n", current->comm, task_pid(current), str, ++die_counter);
notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV);
__asm__ __volatile__("flushw");
__show_regs(regs);
Index: linux-2.6.15-rc1/arch/sparc64/solaris/ioctl.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/sparc64/solaris/ioctl.c
+++ linux-2.6.15-rc1/arch/sparc64/solaris/ioctl.c
@@ -548,13 +548,13 @@ static inline int solaris_S(struct file
return solaris_ioctl(fd, si.cmd, si.data);
}
case 9: /* I_SETSIG */
- return sys_ioctl(fd, FIOSETOWN, current->pid);
+ return sys_ioctl(fd, FIOSETOWN, task_pid(current));
case 10: /* I_GETSIG */
old_fs = get_fs();
set_fs(KERNEL_DS);
sys_ioctl(fd, FIOGETOWN, (unsigned long)&ret);
set_fs(old_fs);
- if (ret == current->pid) return 0x3ff;
+ if (ret == task_pid(current)) return 0x3ff;
else return -EINVAL;
case 11: /* I_FIND */
{
Index: linux-2.6.15-rc1/arch/um/kernel/process_kern.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/um/kernel/process_kern.c
+++ linux-2.6.15-rc1/arch/um/kernel/process_kern.c
@@ -180,7 +180,7 @@ unsigned long stack_sp(unsigned long pag
int current_pid(void)
{
- return(current->pid);
+ return(task_pid(current));
}
void default_idle(void)
@@ -261,7 +261,7 @@ char *current_cmd(void)
void force_sigbus(void)
{
printk(KERN_ERR "Killing pid %d because of a lack of memory\n",
- current->pid);
+ task_pid(current));
lock_kernel();
sigaddset(¤t->pending.signal, SIGBUS);
recalc_sigpending();
Index: linux-2.6.15-rc1/arch/um/kernel/skas/process_kern.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/um/kernel/skas/process_kern.c
+++ linux-2.6.15-rc1/arch/um/kernel/skas/process_kern.c
@@ -32,13 +32,13 @@ void switch_to_skas(void *prev, void *ne
to = next;
/* XXX need to check runqueues[cpu].idle */
- if(current->pid == 0)
+ if(task_pid(current) == 0)
switch_timers(0);
switch_threads(&from->thread.mode.skas.switch_buf,
to->thread.mode.skas.switch_buf);
- if(current->pid == 0)
+ if(task_pid(current) == 0)
switch_timers(1);
}
Index: linux-2.6.15-rc1/arch/um/kernel/trap_kern.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/um/kernel/trap_kern.c
+++ linux-2.6.15-rc1/arch/um/kernel/trap_kern.c
@@ -107,7 +107,7 @@ out_nosemaphore:
* us unable to handle the page fault gracefully.
*/
out_of_memory:
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
up_read(&mm->mmap_sem);
yield();
down_read(&mm->mmap_sem);
Index: linux-2.6.15-rc1/arch/um/sys-x86_64/sysrq.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/um/sys-x86_64/sysrq.c
+++ linux-2.6.15-rc1/arch/um/sys-x86_64/sysrq.c
@@ -16,7 +16,7 @@ void __show_regs(struct pt_regs * regs)
printk("\n");
print_modules();
printk("Pid: %d, comm: %.20s %s %s\n",
- current->pid, current->comm, print_tainted(), system_utsname.release);
+ task_pid(current), current->comm, print_tainted(), system_utsname.release);
printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff,
PT_REGS_RIP(regs));
printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs),
Index: linux-2.6.15-rc1/arch/v850/kernel/bug.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/v850/kernel/bug.c
+++ linux-2.6.15-rc1/arch/v850/kernel/bug.c
@@ -38,7 +38,7 @@ int bad_trap (int trap_num, struct pt_re
{
printk (KERN_CRIT
"unimplemented trap %d called at 0x%08lx, pid %d!\n",
- trap_num, regs->pc, current->pid);
+ trap_num, regs->pc, task_pid(current));
return -ENOSYS;
}
@@ -50,7 +50,7 @@ void unexpected_reset (unsigned long ret
"unexpected reset in %s mode, pid %d"
" (ret_addr = 0x%lx, sp = 0x%lx)\n",
kmode ? "kernel" : "user",
- task ? task->pid : -1,
+ task ? task_pid(task) : -1,
ret_addr, sp);
machine_halt ();
Index: linux-2.6.15-rc1/arch/v850/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/v850/kernel/signal.c
+++ linux-2.6.15-rc1/arch/v850/kernel/signal.c
@@ -338,7 +338,7 @@ static void setup_frame(int sig, struct
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%08lx ra=%08lx\n",
- current->comm, current->pid, frame, regs->pc, );
+ current->comm, task_pid(current), frame, regs->pc, );
#endif
return;
@@ -413,7 +413,7 @@ static void setup_rt_frame(int sig, stru
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
- current->comm, current->pid, frame, regs->pc, regs->pr);
+ current->comm, task_pid(current), frame, regs->pc, regs->pr);
#endif
return;
Index: linux-2.6.15-rc1/arch/x86_64/ia32/ia32_signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/ia32/ia32_signal.c
+++ linux-2.6.15-rc1/arch/x86_64/ia32/ia32_signal.c
@@ -515,7 +515,7 @@ int ia32_setup_frame(int sig, struct k_s
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
- current->comm, current->pid, frame, regs->rip, frame->pretcode);
+ current->comm, task_pid(current), frame, regs->rip, frame->pretcode);
#endif
return 1;
@@ -615,7 +615,7 @@ int ia32_setup_rt_frame(int sig, struct
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
- current->comm, current->pid, frame, regs->rip, frame->pretcode);
+ current->comm, task_pid(current), frame, regs->rip, frame->pretcode);
#endif
return 1;
Index: linux-2.6.15-rc1/arch/x86_64/kernel/mce.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/kernel/mce.c
+++ linux-2.6.15-rc1/arch/x86_64/kernel/mce.c
@@ -248,7 +248,7 @@ void do_machine_check(struct pt_regs * r
but most likely they occur at boot anyways, where
it is best to just halt the machine. */
if ((!user_space && (panic_on_oops || tolerant < 2)) ||
- (unsigned)current->pid <= 1)
+ (unsigned)task_pid(current) <= 1)
mce_panic("Uncorrected machine check", &panicm, mcestart);
/* do_exit takes an awful lot of locks and has as
Index: linux-2.6.15-rc1/arch/x86_64/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/kernel/process.c
+++ linux-2.6.15-rc1/arch/x86_64/kernel/process.c
@@ -269,7 +269,7 @@ void __show_regs(struct pt_regs * regs)
printk("\n");
print_modules();
printk("Pid: %d, comm: %.20s %s %s %.*s\n",
- current->pid, current->comm, print_tainted(),
+ task_pid(current), current->comm, print_tainted(),
system_utsname.release,
(int)strcspn(system_utsname.version, " "),
system_utsname.version);
Index: linux-2.6.15-rc1/arch/x86_64/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/kernel/signal.c
+++ linux-2.6.15-rc1/arch/x86_64/kernel/signal.c
@@ -165,7 +165,7 @@ asmlinkage long sys_rt_sigreturn(struct
goto badframe;
#ifdef DEBUG_SIG
- printk("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n",current->pid,regs.rip,regs.rsp,frame,eax);
+ printk("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n",task_pid(current),regs.rip,regs.rsp,frame,eax);
#endif
if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->rsp) == -EFAULT)
@@ -297,7 +297,7 @@ static int setup_rt_frame(int sig, struc
goto give_sigsegv;
#ifdef DEBUG_SIG
- printk("%d old rip %lx old rsp %lx old rax %lx\n", current->pid,regs->rip,regs->rsp,regs->rax);
+ printk("%d old rip %lx old rsp %lx old rax %lx\n", task_pid(current),regs->rip,regs->rsp,regs->rax);
#endif
/* Set up registers for signal handler */
@@ -324,7 +324,7 @@ static int setup_rt_frame(int sig, struc
ptrace_notify(SIGTRAP);
#ifdef DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
- current->comm, current->pid, frame, regs->rip, frame->pretcode);
+ current->comm, task_pid(current), frame, regs->rip, frame->pretcode);
#endif
return 1;
@@ -346,7 +346,7 @@ handle_signal(unsigned long sig, siginfo
#ifdef DEBUG_SIG
printk("handle_signal pid:%d sig:%lu rip:%lx rsp:%lx regs=%p\n",
- current->pid, sig,
+ task_pid(current), sig,
regs->rip, regs->rsp, regs);
#endif
@@ -490,7 +490,7 @@ void signal_fault(struct pt_regs *regs,
struct task_struct *me = current;
if (exception_trace)
printk("%s[%d] bad frame in %s frame:%p rip:%lx rsp:%lx orax:%lx\n",
- me->comm,me->pid,where,frame,regs->rip,regs->rsp,regs->orig_rax);
+ me->comm,task_pid(me),where,frame,regs->rip,regs->rsp,regs->orig_rax);
force_sig(SIGSEGV, me);
}
Index: linux-2.6.15-rc1/arch/x86_64/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/kernel/traps.c
+++ linux-2.6.15-rc1/arch/x86_64/kernel/traps.c
@@ -282,7 +282,7 @@ void show_registers(struct pt_regs *regs
printk("CPU %d ", cpu);
__show_regs(regs);
printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
- cur->comm, cur->pid, cur->thread_info, cur);
+ cur->comm, task_pid(cur), cur->thread_info, cur);
/*
* When in-kernel, we also print out the stack and code at the
@@ -447,7 +447,7 @@ static void __kprobes do_trap(int trapnr
if (exception_trace && unhandled_signal(tsk, signr))
printk(KERN_INFO
"%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
- tsk->comm, tsk->pid, str,
+ tsk->comm, task_pid(tsk), str,
regs->rip,regs->rsp,error_code);
tsk->thread.error_code = error_code;
@@ -533,7 +533,7 @@ asmlinkage void __kprobes do_general_pro
if (exception_trace && unhandled_signal(tsk, SIGSEGV))
printk(KERN_INFO
"%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
- tsk->comm, tsk->pid,
+ tsk->comm, task_pid(tsk),
regs->rip,regs->rsp,error_code);
tsk->thread.error_code = error_code;
Index: linux-2.6.15-rc1/arch/x86_64/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/mm/fault.c
+++ linux-2.6.15-rc1/arch/x86_64/mm/fault.c
@@ -210,7 +210,7 @@ static int is_errata93(struct pt_regs *r
int unhandled_signal(struct task_struct *tsk, int sig)
{
- if (tsk->pid == 1)
+ if (task_pid(tsk) == 1)
return 1;
if (tsk->ptrace & PT_PTRACED)
return 0;
@@ -482,8 +482,8 @@ bad_area_nosemaphore:
if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {
printk(
"%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n",
- tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
- tsk->comm, tsk->pid, address, regs->rip,
+ task_pid(tsk) > 1 ? KERN_INFO : KERN_EMERG,
+ tsk->comm, task_pid(tsk), address, regs->rip,
regs->rsp, error_code);
}
@@ -545,7 +545,7 @@ no_context:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
goto again;
}
Index: linux-2.6.15-rc1/arch/xtensa/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/xtensa/kernel/signal.c
+++ linux-2.6.15-rc1/arch/xtensa/kernel/signal.c
@@ -570,7 +570,7 @@ static void setup_frame(int sig, struct
#if DEBUG_SIG
printk("SIG deliver (%s:%d): signal=%d sp=%p pc=%08x\n",
- current->comm, current->pid, signal, frame, regs->pc);
+ current->comm, task_pid(current), signal, frame, regs->pc);
#endif
return;
@@ -634,7 +634,7 @@ static void setup_rt_frame(int sig, stru
#if DEBUG_SIG
printk("SIG rt deliver (%s:%d): signal=%d sp=%p pc=%08x\n",
- current->comm, current->pid, signal, frame, regs->pc);
+ current->comm, task_pid(current), signal, frame, regs->pc);
#endif
return;
Index: linux-2.6.15-rc1/arch/xtensa/kernel/syscalls.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/xtensa/kernel/syscalls.c
+++ linux-2.6.15-rc1/arch/xtensa/kernel/syscalls.c
@@ -245,7 +245,7 @@ void system_call (struct pt_regs *regs)
if (strncmp(sysname, "sys_", 4) == 0)
sysname = sysname + 4;
- printk("\017SYSCALL:I:%x:%d:%s %s(", regs->pc, current->pid,
+ printk("\017SYSCALL:I:%x:%d:%s %s(", regs->pc, task_pid(current),
current->comm, sysname);
for (i = 0; i < nargs; i++)
printk((i>0) ? ", %#lx" : "%#lx", parms[i]);
@@ -255,7 +255,7 @@ void system_call (struct pt_regs *regs)
res = syscall((void *)parm0, parm1, parm2, parm3, parm4, parm5);
#if DEBUG
- printk("\017SYSCALL:O:%d:%s %s(",current->pid, current->comm, sysname);
+ printk("\017SYSCALL:O:%d:%s %s(",task_pid(current), current->comm, sysname);
for (i = 0; i < nargs; i++)
printk((i>0) ? ", %#lx" : "%#lx", parms[i]);
if (res < 4096)
Index: linux-2.6.15-rc1/arch/xtensa/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/xtensa/kernel/traps.c
+++ linux-2.6.15-rc1/arch/xtensa/kernel/traps.c
@@ -176,7 +176,7 @@ void do_unhandled(struct pt_regs *regs,
printk("Caught unhandled exception in '%s' "
"(pid = %d, pc = %#010lx) - should not happen\n"
"\tEXCCAUSE is %ld\n",
- current->comm, current->pid, regs->pc, exccause);
+ current->comm, task_pid(current), regs->pc, exccause);
force_sig(SIGILL, current);
}
@@ -228,7 +228,7 @@ do_illegal_instruction(struct pt_regs *r
/* If in user mode, send SIGILL signal to current process. */
printk("Illegal Instruction in '%s' (pid = %d, pc = %#010lx)\n",
- current->comm, current->pid, regs->pc);
+ current->comm, task_pid(current), regs->pc);
force_sig(SIGILL, current);
}
@@ -254,7 +254,7 @@ do_unaligned_user (struct pt_regs *regs)
current->thread.error_code = -3;
printk("Unaligned memory access to %08lx in '%s' "
"(pid = %d, pc = %#010lx)\n",
- regs->excvaddr, current->comm, current->pid, regs->pc);
+ regs->excvaddr, current->comm, task_pid(current), regs->pc);
info.si_signo = SIGBUS;
info.si_errno = 0;
info.si_code = BUS_ADRALN;
Index: linux-2.6.15-rc1/arch/xtensa/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/xtensa/mm/fault.c
+++ linux-2.6.15-rc1/arch/xtensa/mm/fault.c
@@ -64,7 +64,7 @@ void do_page_fault(struct pt_regs *regs)
exccause == XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE) ? 1 : 0;
#if 0
- printk("[%s:%d:%08x:%d:%08x:%s%s]\n", current->comm, current->pid,
+ printk("[%s:%d:%08x:%d:%08x:%s%s]\n", current->comm, task_pid(current),
address, exccause, regs->pc, is_write? "w":"", is_exec? "x":"");
#endif
@@ -144,7 +144,7 @@ bad_area:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/s390/kernel/asm-offsets.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/s390/kernel/asm-offsets.c
+++ linux-2.6.15-rc1/arch/s390/kernel/asm-offsets.c
@@ -22,7 +22,7 @@ int main(void)
DEFINE(__THREAD_mm_segment,
offsetof(struct task_struct, thread.mm_segment),);
BLANK();
- DEFINE(__TASK_pid, offsetof(struct task_struct, pid),);
+ DEFINE(__TASK_pid, offsetof(struct task_struct, __pid),);
BLANK();
DEFINE(__PER_atmid, offsetof(per_struct, lowcore.words.perc_atmid),);
DEFINE(__PER_address, offsetof(per_struct, lowcore.words.address),);
Index: linux-2.6.15-rc1/drivers/s390/crypto/z90main.c
===================================================================
--- linux-2.6.15-rc1.orig/drivers/s390/crypto/z90main.c
+++ linux-2.6.15-rc1/drivers/s390/crypto/z90main.c
@@ -942,7 +942,7 @@ init_work_element(struct work_element *w
step = atomic_inc_return(&z90crypt_step);
memcpy(we_p->caller_id+0, (void *) &pid, sizeof(pid));
memcpy(we_p->caller_id+4, (void *) &step, sizeof(step));
- we_task_pid(p) = pid;
+ we_p->pid = pid;
we_p->priv_data = priv_data;
we_p->status[0] = STAT_DEFAULT;
we_p->audit[0] = 0x00;
Index: linux-2.6.15-rc1/arch/x86_64/ia32/ptrace32.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/ia32/ptrace32.c
+++ linux-2.6.15-rc1/arch/x86_64/ia32/ptrace32.c
@@ -212,7 +212,7 @@ static struct task_struct *find_target(i
read_unlock(&tasklist_lock);
if (child) {
*err = -EPERM;
- if (child->pid == 1)
+ if (task_pid(child) == 1)
goto out;
*err = ptrace_check_attach(child, request == PTRACE_KILL);
if (*err < 0)
Index: linux-2.6.15-rc1/arch/x86_64/kernel/asm-offsets.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/x86_64/kernel/asm-offsets.c
+++ linux-2.6.15-rc1/arch/x86_64/kernel/asm-offsets.c
@@ -26,7 +26,7 @@ int main(void)
ENTRY(state);
ENTRY(flags);
ENTRY(thread);
- ENTRY(pid);
+ ENTRY(__pid);
BLANK();
#undef ENTRY
#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
Index: linux-2.6.15-rc1/arch/powerpc/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/powerpc/mm/fault.c
+++ linux-2.6.15-rc1/arch/powerpc/mm/fault.c
@@ -350,7 +350,7 @@ bad_area_nosemaphore:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/powerpc/xmon/xmon.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/powerpc/xmon/xmon.c
+++ linux-2.6.15-rc1/arch/powerpc/xmon/xmon.c
@@ -1368,7 +1368,7 @@ void excprint(struct pt_regs *fp)
#endif
if (current) {
printf(" pid = %ld, comm = %s\n",
- current->pid, current->comm);
+ task_pid(current), current->comm);
}
if (trap == 0x700)
Index: linux-2.6.15-rc1/arch/powerpc/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/powerpc/kernel/traps.c
+++ linux-2.6.15-rc1/arch/powerpc/kernel/traps.c
@@ -195,7 +195,7 @@ void _exception(int signr, struct pt_reg
* generate the same exception over and over again and we get
* nowhere. Better to kill it and let the kernel panic.
*/
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
__sighandler_t handler;
spin_lock_irq(¤t->sighand->siglock);
@@ -860,7 +860,7 @@ void nonrecoverable_exception(struct pt_
void trace_syscall(struct pt_regs *regs)
{
printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
- current, current->pid, regs->nip, regs->link, regs->gpr[0],
+ current, task_pid(current), regs->nip, regs->link, regs->gpr[0],
regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
}
Index: linux-2.6.15-rc1/arch/powerpc/platforms/pseries/ras.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/powerpc/platforms/pseries/ras.c
+++ linux-2.6.15-rc1/arch/powerpc/platforms/pseries/ras.c
@@ -313,10 +313,10 @@ static int recover_mce(struct pt_regs *r
err->disposition == RTAS_DISP_NOT_RECOVERED &&
err->target == RTAS_TARGET_MEMORY &&
err->type == RTAS_TYPE_ECC_UNCORR &&
- !(current->pid == 0 || current->pid == 1)) {
+ !(task_pid(current) == 0 || task_pid(current) == 1)) {
/* Kill off a user process with an ECC error */
printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
- current->pid);
+ task_pid(current));
/* XXX something better for ECC error? */
_exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
nonfatal = 1;
Index: linux-2.6.15-rc1/arch/powerpc/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/powerpc/kernel/process.c
+++ linux-2.6.15-rc1/arch/powerpc/kernel/process.c
@@ -402,7 +402,7 @@ void show_regs(struct pt_regs * regs)
if (trap == 0x300 || trap == 0x600)
printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
printk("TASK = %p[%d] '%s' THREAD: %p",
- current, current->pid, current->comm, current->thread_info);
+ current, task_pid(current), current->comm, current->thread_info);
#ifdef CONFIG_SMP
printk(" CPU: %d", smp_processor_id());
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 03/13] Change pid accesses: filesystems.
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 01/13] Change pid accesses: drivers Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 02/13] Change pid accesses: most archs Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 04/13] Change pid accesses: include/ Serge E. Hallyn
` (13 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B2-change-pid-tgid-references-fs --]
[-- Type: text/plain, Size: 33343 bytes --]
Replace-Subject: Change pid accesses: filesystems.
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for filesystems.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
fs/9p/debug.h | 4 ++--
fs/9p/fid.c | 5 +++--
fs/afs/cmservice.c | 2 +-
fs/afs/kafsasyncd.c | 2 +-
fs/afs/kafstimod.c | 2 +-
fs/autofs/root.c | 2 +-
fs/autofs4/autofs_i.h | 2 +-
fs/autofs4/root.c | 2 +-
fs/binfmt_elf.c | 8 ++++----
fs/binfmt_elf_fdpic.c | 2 +-
fs/binfmt_flat.c | 2 +-
fs/cifs/cifssmb.c | 2 +-
fs/cifs/connect.c | 2 +-
fs/cifs/dir.c | 2 +-
fs/cifs/file.c | 4 ++--
fs/cifs/misc.c | 4 ++--
fs/cifs/transport.c | 2 +-
fs/coda/upcall.c | 2 +-
fs/compat.c | 2 +-
fs/devfs/base.c | 2 +-
fs/dnotify.c | 2 +-
fs/exec.c | 8 ++++----
fs/ext2/inode.c | 2 +-
fs/ext3/inode.c | 2 +-
fs/fs-writeback.c | 2 +-
fs/fuse/dev.c | 2 +-
fs/jffs2/background.c | 2 +-
fs/jffs2/debug.h | 8 ++++----
fs/lockd/clntproc.c | 2 +-
fs/lockd/svc.c | 6 +++---
fs/locks.c | 16 ++++++++--------
fs/nfs/callback.c | 2 +-
fs/nfs/nfs3proc.c | 2 +-
fs/nfs/nfs4proc.c | 2 +-
fs/nfsd/nfs4state.c | 8 ++++----
fs/nfsd/vfs.c | 6 +++---
fs/proc/array.c | 12 +++++++-----
fs/proc/base.c | 16 ++++++++--------
fs/smbfs/proc.c | 4 ++--
fs/smbfs/smbiod.c | 4 ++--
fs/xfs/linux-2.6/xfs_buf.c | 2 +-
fs/xfs/linux-2.6/xfs_linux.h | 2 +-
fs/xfs/support/debug.c | 2 +-
43 files changed, 86 insertions(+), 83 deletions(-)
Index: linux-2.6.15-rc1/fs/9p/debug.h
===================================================================
--- linux-2.6.15-rc1.orig/fs/9p/debug.h
+++ linux-2.6.15-rc1/fs/9p/debug.h
@@ -39,13 +39,13 @@ extern int v9fs_debug_level;
do { \
if((v9fs_debug_level & level)==level) \
printk(KERN_NOTICE "-- %s (%d): " \
- format , __FUNCTION__, current->pid , ## arg); \
+ format , __FUNCTION__, task_pid(current) , ## arg); \
} while(0)
#define eprintk(level, format, arg...) \
do { \
printk(level "v9fs: %s (%d): " \
- format , __FUNCTION__, current->pid , ## arg); \
+ format , __FUNCTION__, task_pid(current) , ## arg); \
} while(0)
#if DEBUG_DUMP_PKT
Index: linux-2.6.15-rc1/fs/9p/fid.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/9p/fid.c
+++ linux-2.6.15-rc1/fs/9p/fid.c
@@ -60,7 +60,7 @@ static int v9fs_fid_insert(struct v9fs_f
}
fid->uid = current->uid;
- fid->pid = current->pid;
+ fid->pid = task_pid(current);
list_add(&fid->list, fid_list);
return 0;
}
@@ -242,7 +242,8 @@ struct v9fs_fid *v9fs_fid_get_created(st
ret = NULL;
if (fid_list) {
list_for_each_entry_safe(fid, ftmp, fid_list, list) {
- if (fid->fidcreate && fid->pid == current->pid) {
+ if (fid->fidcreate && fid->pid ==
+ task_pid(current)) {
list_del(&fid->list);
ret = fid;
break;
Index: linux-2.6.15-rc1/fs/afs/cmservice.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/afs/cmservice.c
+++ linux-2.6.15-rc1/fs/afs/cmservice.c
@@ -118,7 +118,7 @@ static int kafscmd(void *arg)
_SRXAFSCM_xxxx_t func;
int die;
- printk("kAFS: Started kafscmd %d\n", current->pid);
+ printk("kAFS: Started kafscmd %d\n", task_pid(current));
daemonize("kafscmd");
Index: linux-2.6.15-rc1/fs/afs/kafsasyncd.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/afs/kafsasyncd.c
+++ linux-2.6.15-rc1/fs/afs/kafsasyncd.c
@@ -92,7 +92,7 @@ static int kafsasyncd(void *arg)
kafsasyncd_task = current;
- printk("kAFS: Started kafsasyncd %d\n", current->pid);
+ printk("kAFS: Started kafsasyncd %d\n", task_pid(current));
daemonize("kafsasyncd");
Index: linux-2.6.15-rc1/fs/afs/kafstimod.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/afs/kafstimod.c
+++ linux-2.6.15-rc1/fs/afs/kafstimod.c
@@ -69,7 +69,7 @@ static int kafstimod(void *arg)
DECLARE_WAITQUEUE(myself, current);
- printk("kAFS: Started kafstimod %d\n", current->pid);
+ printk("kAFS: Started kafstimod %d\n", task_pid(current));
daemonize("kafstimod");
Index: linux-2.6.15-rc1/fs/autofs/root.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/autofs/root.c
+++ linux-2.6.15-rc1/fs/autofs/root.c
@@ -213,7 +213,7 @@ static struct dentry *autofs_root_lookup
oz_mode = autofs_oz_mode(sbi);
DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n",
- current->pid, process_group(current), sbi->catatonic, oz_mode));
+ task_pid(current), process_group(current), sbi->catatonic, oz_mode));
/*
* Mark the dentry incomplete, but add it. This is needed so
Index: linux-2.6.15-rc1/fs/autofs4/autofs_i.h
===================================================================
--- linux-2.6.15-rc1.orig/fs/autofs4/autofs_i.h
+++ linux-2.6.15-rc1/fs/autofs4/autofs_i.h
@@ -33,7 +33,7 @@
/* #define DEBUG */
#ifdef DEBUG
-#define DPRINTK(fmt,args...) do { printk(KERN_DEBUG "pid %d: %s: " fmt "\n" , current->pid , __FUNCTION__ , ##args); } while(0)
+#define DPRINTK(fmt,args...) do { printk(KERN_DEBUG "pid %d: %s: " fmt "\n" , task_pid(current) , __FUNCTION__ , ##args); } while(0)
#else
#define DPRINTK(fmt,args...) do {} while(0)
#endif
Index: linux-2.6.15-rc1/fs/autofs4/root.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/autofs4/root.c
+++ linux-2.6.15-rc1/fs/autofs4/root.c
@@ -465,7 +465,7 @@ static struct dentry *autofs4_lookup(str
oz_mode = autofs4_oz_mode(sbi);
DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
- current->pid, process_group(current), sbi->catatonic, oz_mode);
+ task_pid(current), process_group(current), sbi->catatonic, oz_mode);
/*
* Mark the dentry incomplete, but add it. This is needed so
Index: linux-2.6.15-rc1/fs/binfmt_elf.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/binfmt_elf.c
+++ linux-2.6.15-rc1/fs/binfmt_elf.c
@@ -1270,8 +1270,8 @@ static void fill_prstatus(struct elf_prs
prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
prstatus->pr_sigpend = p->pending.signal.sig[0];
prstatus->pr_sighold = p->blocked.sig[0];
- prstatus->pr_pid = p->pid;
- prstatus->pr_ppid = p->parent->pid;
+ prstatus->pr_pid = task_pid(p);
+ prstatus->pr_ppid = task_pid(p->parent);
prstatus->pr_pgrp = process_group(p);
prstatus->pr_sid = p->signal->session;
if (thread_group_leader(p)) {
@@ -1316,8 +1316,8 @@ static int fill_psinfo(struct elf_prpsin
psinfo->pr_psargs[i] = ' ';
psinfo->pr_psargs[len] = 0;
- psinfo->pr_pid = p->pid;
- psinfo->pr_ppid = p->parent->pid;
+ psinfo->pr_pid = task_pid(p);
+ psinfo->pr_ppid = task_pid(p->parent);
psinfo->pr_pgrp = process_group(p);
psinfo->pr_sid = p->signal->session;
Index: linux-2.6.15-rc1/fs/binfmt_elf_fdpic.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/binfmt_elf_fdpic.c
+++ linux-2.6.15-rc1/fs/binfmt_elf_fdpic.c
@@ -479,7 +479,7 @@ static int create_elf_fdpic_tables(struc
* removed for 2.5
*/
if (smp_num_siblings > 1)
- sp = sp - ((current->pid % 64) << 7);
+ sp = sp - ((task_pid(current) % 64) << 7);
#endif
sp &= ~7UL;
Index: linux-2.6.15-rc1/fs/binfmt_flat.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/binfmt_flat.c
+++ linux-2.6.15-rc1/fs/binfmt_flat.c
@@ -95,7 +95,7 @@ static struct linux_binfmt flat_format =
static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file)
{
printk("Process %s:%d received signr %d and should have core dumped\n",
- current->comm, current->pid, (int) signr);
+ current->comm, task_pid(current), (int) signr);
return(1);
}
Index: linux-2.6.15-rc1/fs/cifs/cifssmb.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/cifs/cifssmb.c
+++ linux-2.6.15-rc1/fs/cifs/cifssmb.c
@@ -1247,7 +1247,7 @@ CIFSSMBLock(const int xid, struct cifsTc
pSMB->Fid = smb_file_id; /* netfid stays le */
if((numLock != 0) || (numUnlock != 0)) {
- pSMB->Locks[0].Pid = cpu_to_le16(current->tgid);
+ pSMB->Locks[0].Pid = cpu_to_le16(task_tgid(current));
/* BB where to store pid high? */
pSMB->Locks[0].LengthLow = cpu_to_le32((u32)len);
pSMB->Locks[0].LengthHigh = cpu_to_le32((u32)(len>>32));
Index: linux-2.6.15-rc1/fs/cifs/connect.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/cifs/connect.c
+++ linux-2.6.15-rc1/fs/cifs/connect.c
@@ -345,7 +345,7 @@ cifs_demultiplex_thread(struct TCP_Serve
allow_signal(SIGKILL);
current->flags |= PF_MEMALLOC;
server->tsk = current; /* save process info to wake at shutdown */
- cFYI(1, ("Demultiplex PID: %d", current->pid));
+ cFYI(1, ("Demultiplex PID: %d", task_pid(current)));
write_lock(&GlobalSMBSeslock);
atomic_inc(&tcpSesAllocCount);
length = tcpSesAllocCount.counter;
Index: linux-2.6.15-rc1/fs/cifs/dir.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/cifs/dir.c
+++ linux-2.6.15-rc1/fs/cifs/dir.c
@@ -255,7 +255,7 @@ cifs_create(struct inode *inode, struct
memset((char *)pCifsFile, 0,
sizeof (struct cifsFileInfo));
pCifsFile->netfid = fileHandle;
- pCifsFile->pid = current->tgid;
+ pCifsFile->pid = task_tgid(current);
pCifsFile->pInode = newinode;
pCifsFile->invalidHandle = FALSE;
pCifsFile->closePend = FALSE;
Index: linux-2.6.15-rc1/fs/cifs/file.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/cifs/file.c
+++ linux-2.6.15-rc1/fs/cifs/file.c
@@ -45,7 +45,7 @@ static inline struct cifsFileInfo *cifs_
{
memset(private_data, 0, sizeof(struct cifsFileInfo));
private_data->netfid = netfid;
- private_data->pid = current->tgid;
+ private_data->pid = task_tgid(current);
init_MUTEX(&private_data->fh_sem);
private_data->pfile = file; /* needed for writepage */
private_data->pInode = inode;
@@ -182,7 +182,7 @@ int cifs_open(struct inode *inode, struc
pCifsFile = list_entry(tmp, struct cifsFileInfo,
flist);
if ((pCifsFile->pfile == NULL) &&
- (pCifsFile->pid == current->tgid)) {
+ (pCifsFile->pid == task_tgid(current))) {
/* mode set in cifs_create */
/* needed for writepage */
Index: linux-2.6.15-rc1/fs/cifs/misc.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/cifs/misc.c
+++ linux-2.6.15-rc1/fs/cifs/misc.c
@@ -308,8 +308,8 @@ header_assemble(struct smb_hdr *buffer,
buffer->Command = smb_command;
buffer->Flags = 0x00; /* case sensitive */
buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES;
- buffer->Pid = cpu_to_le16((__u16)current->tgid);
- buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16));
+ buffer->Pid = cpu_to_le16((__u16)task_tgid(current));
+ buffer->PidHigh = cpu_to_le16((__u16)(task_tgid(current) >> 16));
spin_lock(&GlobalMid_Lock);
spin_unlock(&GlobalMid_Lock);
if (treeCon) {
Index: linux-2.6.15-rc1/fs/cifs/transport.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/cifs/transport.c
+++ linux-2.6.15-rc1/fs/cifs/transport.c
@@ -56,7 +56,7 @@ AllocMidQEntry(struct smb_hdr *smb_buffe
else {
memset(temp, 0, sizeof (struct mid_q_entry));
temp->mid = smb_buffer->Mid; /* always LE */
- temp->pid = current->pid;
+ temp->pid = task_pid(current);
temp->command = smb_buffer->Command;
cFYI(1, ("For smb_command %d", temp->command));
/* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
Index: linux-2.6.15-rc1/fs/coda/upcall.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/coda/upcall.c
+++ linux-2.6.15-rc1/fs/coda/upcall.c
@@ -52,7 +52,7 @@ static void *alloc_upcall(int opcode, in
return ERR_PTR(-ENOMEM);
inp->ih.opcode = opcode;
- inp->ih.pid = current->pid;
+ inp->ih.pid = task_pid(current);
inp->ih.pgid = process_group(current);
#ifdef CONFIG_CODA_FS_OLD_API
memset(&inp->ih.cred, 0, sizeof(struct coda_cred));
Index: linux-2.6.15-rc1/fs/compat.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/compat.c
+++ linux-2.6.15-rc1/fs/compat.c
@@ -332,7 +332,7 @@ static void compat_ioctl_error(struct fi
sprintf(buf, "%02x", buf[1]);
printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
"cmd(%08x){%s} arg(%08x) on %s\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
(int)fd, (unsigned int)cmd, buf,
(unsigned int)arg, fn);
Index: linux-2.6.15-rc1/fs/devfs/base.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/devfs/base.c
+++ linux-2.6.15-rc1/fs/devfs/base.c
@@ -2695,7 +2695,7 @@ static int devfsd_ioctl(struct inode *in
spin_unlock(&lock);
fs_info->devfsd_pgrp =
(process_group(current) ==
- current->pid) ? process_group(current) : 0;
+ task_pid(current)) ? process_group(current) : 0;
fs_info->devfsd_file = file;
fs_info->devfsd_info =
kmalloc(sizeof *fs_info->devfsd_info, GFP_KERNEL);
Index: linux-2.6.15-rc1/fs/dnotify.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/dnotify.c
+++ linux-2.6.15-rc1/fs/dnotify.c
@@ -92,7 +92,7 @@ int fcntl_dirnotify(int fd, struct file
prev = &odn->dn_next;
}
- error = f_setown(filp, current->pid, 0);
+ error = f_setown(filp, task_pid(current), 0);
if (error)
goto out_free;
Index: linux-2.6.15-rc1/fs/exec.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/exec.c
+++ linux-2.6.15-rc1/fs/exec.c
@@ -685,8 +685,8 @@ static inline int de_thread(struct task_
proc_dentry2 = proc_pid_unhash(leader);
write_lock_irq(&tasklist_lock);
- BUG_ON(leader->tgid != current->tgid);
- BUG_ON(current->pid == current->tgid);
+ BUG_ON(task_tgid(leader) != task_tgid(current));
+ BUG_ON(task_pid(current) == task_tgid(current));
/*
* An exec() starts a new thread group with the
* TGID of the previous thread group. Rehash the
@@ -1292,7 +1292,7 @@ static void format_corename(char *corena
case 'p':
pid_in_pattern = 1;
rc = snprintf(out_ptr, out_end - out_ptr,
- "%d", current->tgid);
+ "%d", task_tgid(current));
if (rc > out_end - out_ptr)
goto out;
out_ptr += rc;
@@ -1364,7 +1364,7 @@ static void format_corename(char *corena
if (!pid_in_pattern
&& (core_uses_pid || atomic_read(¤t->mm->mm_users) != 1)) {
rc = snprintf(out_ptr, out_end - out_ptr,
- ".%d", current->tgid);
+ ".%d", task_tgid(current));
if (rc > out_end - out_ptr)
goto out;
out_ptr += rc;
Index: linux-2.6.15-rc1/fs/ext2/inode.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/ext2/inode.c
+++ linux-2.6.15-rc1/fs/ext2/inode.c
@@ -344,7 +344,7 @@ static unsigned long ext2_find_near(stru
*/
bg_start = (ei->i_block_group * EXT2_BLOCKS_PER_GROUP(inode->i_sb)) +
le32_to_cpu(EXT2_SB(inode->i_sb)->s_es->s_first_data_block);
- colour = (current->pid % 16) *
+ colour = (task_pid(current) % 16) *
(EXT2_BLOCKS_PER_GROUP(inode->i_sb) / 16);
return bg_start + colour;
}
Index: linux-2.6.15-rc1/fs/ext3/inode.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/ext3/inode.c
+++ linux-2.6.15-rc1/fs/ext3/inode.c
@@ -443,7 +443,7 @@ static unsigned long ext3_find_near(stru
*/
bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
- colour = (current->pid % 16) *
+ colour = (task_pid(current) % 16) *
(EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16);
return bg_start + colour;
}
Index: linux-2.6.15-rc1/fs/fs-writeback.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/fs-writeback.c
+++ linux-2.6.15-rc1/fs/fs-writeback.c
@@ -89,7 +89,7 @@ void __mark_inode_dirty(struct inode *in
if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev"))
printk(KERN_DEBUG
"%s(%d): dirtied inode %lu (%s) on %s\n",
- current->comm, current->pid, inode->i_ino,
+ current->comm, task_pid(current), inode->i_ino,
name, inode->i_sb->s_id);
}
Index: linux-2.6.15-rc1/fs/fuse/dev.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/fuse/dev.c
+++ linux-2.6.15-rc1/fs/fuse/dev.c
@@ -99,7 +99,7 @@ static struct fuse_req *do_get_request(s
req->preallocated = 1;
req->in.h.uid = current->fsuid;
req->in.h.gid = current->fsgid;
- req->in.h.pid = current->pid;
+ req->in.h.pid = task_pid(current);
return req;
}
Index: linux-2.6.15-rc1/fs/jffs2/background.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/jffs2/background.c
+++ linux-2.6.15-rc1/fs/jffs2/background.c
@@ -60,7 +60,7 @@ void jffs2_stop_garbage_collect_thread(s
int wait = 0;
spin_lock(&c->erase_completion_lock);
if (c->gc_task) {
- D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid));
+ D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task_pid(task)));
send_sig(SIGKILL, c->gc_task, 1);
wait = 1;
}
Index: linux-2.6.15-rc1/fs/lockd/clntproc.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/lockd/clntproc.c
+++ linux-2.6.15-rc1/fs/lockd/clntproc.c
@@ -130,7 +130,7 @@ static void nlmclnt_setlockargs(struct n
lock->caller = system_utsname.nodename;
lock->oh.data = req->a_owner;
lock->oh.len = sprintf(req->a_owner, "%d@%s",
- current->pid, system_utsname.nodename);
+ task_pid(current), system_utsname.nodename);
locks_copy_lock(&lock->fl, fl);
}
Index: linux-2.6.15-rc1/fs/lockd/svc.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/lockd/svc.c
+++ linux-2.6.15-rc1/fs/lockd/svc.c
@@ -111,7 +111,7 @@ lockd(struct svc_rqst *rqstp)
/*
* Let our maker know we're running.
*/
- nlmsvc_pid = current->pid;
+ nlmsvc_pid = task_pid(current);
up(&lockd_start);
daemonize("lockd");
@@ -135,7 +135,7 @@ lockd(struct svc_rqst *rqstp)
* NFS mount or NFS daemon has gone away, and we've been sent a
* signal, or else another process has taken over our job.
*/
- while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) {
+ while ((nlmsvc_users || !signalled()) && nlmsvc_pid == task_pid(current)) {
long timeout = MAX_SCHEDULE_TIMEOUT;
if (signalled()) {
@@ -182,7 +182,7 @@ lockd(struct svc_rqst *rqstp)
* Check whether there's a new lockd process before
* shutting down the hosts and clearing the slot.
*/
- if (!nlmsvc_pid || current->pid == nlmsvc_pid) {
+ if (!nlmsvc_pid || task_pid(current) == nlmsvc_pid) {
if (nlmsvc_ops)
nlmsvc_invalidate_all();
nlm_shutdown_hosts();
Index: linux-2.6.15-rc1/fs/locks.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/locks.c
+++ linux-2.6.15-rc1/fs/locks.c
@@ -268,7 +268,7 @@ static int flock_make_lock(struct file *
return -ENOMEM;
fl->fl_file = filp;
- fl->fl_pid = current->tgid;
+ fl->fl_pid = task_tgid(current);
fl->fl_flags = FL_FLOCK;
fl->fl_type = type;
fl->fl_end = OFFSET_MAX;
@@ -334,7 +334,7 @@ static int flock_to_posix_lock(struct fi
return -EOVERFLOW;
fl->fl_owner = current->files;
- fl->fl_pid = current->tgid;
+ fl->fl_pid = task_tgid(current);
fl->fl_file = filp;
fl->fl_flags = FL_POSIX;
fl->fl_ops = NULL;
@@ -380,7 +380,7 @@ static int flock64_to_posix_lock(struct
return -EOVERFLOW;
fl->fl_owner = current->files;
- fl->fl_pid = current->tgid;
+ fl->fl_pid = task_tgid(current);
fl->fl_file = filp;
fl->fl_flags = FL_POSIX;
fl->fl_ops = NULL;
@@ -433,7 +433,7 @@ static struct lock_manager_operations le
static int lease_init(struct file *filp, int type, struct file_lock *fl)
{
fl->fl_owner = current->files;
- fl->fl_pid = current->tgid;
+ fl->fl_pid = task_tgid(current);
fl->fl_file = filp;
fl->fl_flags = FL_LEASE;
@@ -1043,7 +1043,7 @@ int locks_mandatory_area(int read_write,
locks_init_lock(&fl);
fl.fl_owner = current->files;
- fl.fl_pid = current->tgid;
+ fl.fl_pid = task_tgid(current);
fl.fl_file = filp;
fl.fl_flags = FL_POSIX | FL_ACCESS;
if (filp && !(filp->f_flags & O_NONBLOCK))
@@ -1442,7 +1442,7 @@ int fcntl_setlease(unsigned int fd, stru
goto out_unlock;
}
- error = f_setown(filp, current->pid, 0);
+ error = f_setown(filp, task_pid(current), 0);
out_unlock:
unlock_kernel();
return error;
@@ -1861,7 +1861,7 @@ void locks_remove_posix(struct file *fil
lock.fl_start = 0;
lock.fl_end = OFFSET_MAX;
lock.fl_owner = owner;
- lock.fl_pid = current->tgid;
+ lock.fl_pid = task_tgid(current);
lock.fl_file = filp;
lock.fl_ops = NULL;
lock.fl_lmops = NULL;
@@ -1905,7 +1905,7 @@ void locks_remove_flock(struct file *fil
if (filp->f_op && filp->f_op->flock) {
struct file_lock fl = {
- .fl_pid = current->tgid,
+ .fl_pid = task_tgid(current),
.fl_file = filp,
.fl_flags = FL_FLOCK,
.fl_type = F_UNLCK,
Index: linux-2.6.15-rc1/fs/nfs/callback.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/nfs/callback.c
+++ linux-2.6.15-rc1/fs/nfs/callback.c
@@ -44,7 +44,7 @@ static void nfs_callback_svc(struct svc_
__module_get(THIS_MODULE);
lock_kernel();
- nfs_callback_info.pid = current->pid;
+ nfs_callback_info.pid = task_pid(current);
daemonize("nfsv4-svc");
/* Process request with signals blocked, but allow SIGKILL. */
allow_signal(SIGKILL);
Index: linux-2.6.15-rc1/fs/nfs/nfs3proc.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/nfs/nfs3proc.c
+++ linux-2.6.15-rc1/fs/nfs/nfs3proc.c
@@ -323,7 +323,7 @@ nfs3_proc_create(struct inode *dir, stru
if (flags & O_EXCL) {
arg.createmode = NFS3_CREATE_EXCLUSIVE;
arg.verifier[0] = jiffies;
- arg.verifier[1] = current->pid;
+ arg.verifier[1] = task_pid(current);
}
sattr->ia_mode &= ~current->fs->umask;
Index: linux-2.6.15-rc1/fs/nfs/nfs4proc.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/nfs/nfs4proc.c
+++ linux-2.6.15-rc1/fs/nfs/nfs4proc.c
@@ -724,7 +724,7 @@ static int _nfs4_do_open(struct inode *d
if (flags & O_EXCL) {
u32 *p = (u32 *) o_arg.u.verifier.data;
p[0] = jiffies;
- p[1] = current->pid;
+ p[1] = task_pid(current);
} else
o_arg.u.attrs = sattr;
/* Serialization for the sequence id */
Index: linux-2.6.15-rc1/fs/nfsd/nfs4state.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/nfsd/nfs4state.c
+++ linux-2.6.15-rc1/fs/nfsd/nfs4state.c
@@ -1740,7 +1740,7 @@ nfs4_open_delegation(struct svc_fh *fh,
fl.fl_end = OFFSET_MAX;
fl.fl_owner = (fl_owner_t)dp;
fl.fl_file = stp->st_vfs_file;
- fl.fl_pid = current->tgid;
+ fl.fl_pid = task_tgid(current);
/* setlease checks to see if delegation should be handed out.
* the lock_manager callbacks fl_mylease and fl_change are used
@@ -2784,7 +2784,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
goto out;
}
file_lock.fl_owner = (fl_owner_t)lock_sop;
- file_lock.fl_pid = current->tgid;
+ file_lock.fl_pid = task_tgid(current);
file_lock.fl_file = filp;
file_lock.fl_flags = FL_POSIX;
@@ -2903,7 +2903,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru
&lockt->lt_clientid, &lockt->lt_owner);
if (lockt->lt_stateowner)
file_lock.fl_owner = (fl_owner_t)lockt->lt_stateowner;
- file_lock.fl_pid = current->tgid;
+ file_lock.fl_pid = task_tgid(current);
file_lock.fl_flags = FL_POSIX;
file_lock.fl_start = lockt->lt_offset;
@@ -2962,7 +2962,7 @@ nfsd4_locku(struct svc_rqst *rqstp, stru
locks_init_lock(&file_lock);
file_lock.fl_type = F_UNLCK;
file_lock.fl_owner = (fl_owner_t) locku->lu_stateowner;
- file_lock.fl_pid = current->tgid;
+ file_lock.fl_pid = task_tgid(current);
file_lock.fl_file = filp;
file_lock.fl_flags = FL_POSIX;
file_lock.fl_start = locku->lu_offset;
Index: linux-2.6.15-rc1/fs/nfsd/vfs.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/nfsd/vfs.c
+++ linux-2.6.15-rc1/fs/nfsd/vfs.c
@@ -955,13 +955,13 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
if (EX_WGATHER(exp)) {
if (atomic_read(&inode->i_writecount) > 1
|| (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) {
- dprintk("nfsd: write defer %d\n", current->pid);
+ dprintk("nfsd: write defer %d\n", task_pid(current));
msleep(10);
- dprintk("nfsd: write resume %d\n", current->pid);
+ dprintk("nfsd: write resume %d\n", task_pid(current));
}
if (inode->i_state & I_DIRTY) {
- dprintk("nfsd: write sync %d\n", current->pid);
+ dprintk("nfsd: write sync %d\n", task_pid(current));
nfsd_sync(file);
}
#if 0
Index: linux-2.6.15-rc1/fs/proc/array.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/proc/array.c
+++ linux-2.6.15-rc1/fs/proc/array.c
@@ -174,9 +174,10 @@ static inline char * task_state(struct t
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
(p->sleep_avg/1024)*100/(1020000000/1024),
- p->tgid,
- p->pid, pid_alive(p) ? p->group_leader->real_parent->tgid : 0,
- pid_alive(p) && p->ptrace ? p->parent->pid : 0,
+ task_tgid(p),
+ task_pid(p), pid_alive(p) ?
+ task_tgid(p->group_leader->real_parent) : 0,
+ pid_alive(p) && p->ptrace ? task_pid(p->parent) : 0,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
read_unlock(&tasklist_lock);
@@ -388,7 +389,8 @@ static int do_task_stat(struct task_stru
}
it_real_value = task->signal->it_real_value;
}
- ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0;
+ ppid = pid_alive(task) ?
+ task_tgid(task->group_leader->real_parent) : 0;
read_unlock(&tasklist_lock);
if (!whole || num_threads<2)
@@ -415,7 +417,7 @@ static int do_task_stat(struct task_stru
res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
%lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu \
%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n",
- task->pid,
+ task_pid(task),
tcomm,
state,
ppid,
Index: linux-2.6.15-rc1/fs/proc/base.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/proc/base.c
+++ linux-2.6.15-rc1/fs/proc/base.c
@@ -1160,7 +1160,7 @@ static int proc_readfd(struct file * fil
if (!pid_alive(p))
goto out;
retval = 0;
- tid = p->pid;
+ tid = task_pid(p);
fd = filp->f_pos;
switch (fd) {
@@ -1227,7 +1227,7 @@ static int proc_pident_readdir(struct fi
goto out;
ret = 0;
- pid = proc_task(inode)->pid;
+ pid = task_pid(proc_task(inode));
i = filp->f_pos;
switch (i) {
case 0:
@@ -1312,7 +1312,7 @@ static struct inode *proc_pid_make_inode
ei = PROC_I(inode);
ei->task = NULL;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
- inode->i_ino = fake_ino(task->pid, ino);
+ inode->i_ino = fake_ino(task_pid(task), ino);
if (!pid_alive(task))
goto out_unlock;
@@ -1878,14 +1878,14 @@ static int proc_self_readlink(struct den
int buflen)
{
char tmp[30];
- sprintf(tmp, "%d", current->tgid);
+ sprintf(tmp, "%d", task_tgid(current));
return vfs_readlink(dentry,buffer,buflen,tmp);
}
static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
{
char tmp[30];
- sprintf(tmp, "%d", current->tgid);
+ sprintf(tmp, "%d", task_tgid(current));
return ERR_PTR(vfs_follow_link(nd,tmp));
}
@@ -2042,7 +2042,7 @@ static struct dentry *proc_task_lookup(s
read_unlock(&tasklist_lock);
if (!task)
goto out;
- if (leader->tgid != task->tgid)
+ if (task_tgid(leader) != task_tgid(task))
goto out_drop_task;
inode = proc_pid_make_inode(dir->i_sb, task, PROC_TID_INO);
@@ -2100,7 +2100,7 @@ static int get_tgid_list(int index, unsi
p = next_task(&init_task);
for ( ; p != &init_task; p = next_task(p)) {
- int tgid = p->pid;
+ int tgid = task_pid(p);
if (!pid_alive(p))
continue;
if (--index >= 0)
@@ -2133,7 +2133,7 @@ static int get_tid_list(int index, unsig
* via next_thread().
*/
if (pid_alive(task)) do {
- int tid = task->pid;
+ int tid = task_pid(task);
if (--index >= 0)
continue;
Index: linux-2.6.15-rc1/fs/smbfs/proc.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/smbfs/proc.c
+++ linux-2.6.15-rc1/fs/smbfs/proc.c
@@ -852,7 +852,7 @@ smb_newconn(struct smb_sb_info *server,
struct sock *sk;
int error;
- VERBOSE("fd=%d, pid=%d\n", opt->fd, current->pid);
+ VERBOSE("fd=%d, pid=%d\n", opt->fd, task_pid(current));
smb_lock_server(server);
@@ -876,7 +876,7 @@ smb_newconn(struct smb_sb_info *server,
goto out_putf;
server->sock_file = filp;
- server->conn_pid = current->pid;
+ server->conn_pid = task_pid(current);
server->opt = *opt;
server->generation += 1;
server->state = CONN_VALID;
Index: linux-2.6.15-rc1/fs/smbfs/smbiod.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/smbfs/smbiod.c
+++ linux-2.6.15-rc1/fs/smbfs/smbiod.c
@@ -294,7 +294,7 @@ static int smbiod(void *unused)
allow_signal(SIGKILL);
- VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid);
+ VERBOSE("SMB Kernel thread starting (%d) ...\n", task_pid(current));
for (;;) {
struct smb_sb_info *server;
@@ -336,6 +336,6 @@ static int smbiod(void *unused)
spin_unlock(&servers_lock);
}
- VERBOSE("SMB Kernel thread exiting (%d) ...\n", current->pid);
+ VERBOSE("SMB Kernel thread exiting (%d) ...\n", task_pid(current));
module_put_and_exit(0);
}
Index: linux-2.6.15-rc1/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/xfs/linux-2.6/xfs_buf.c
+++ linux-2.6.15-rc1/fs/xfs/linux-2.6/xfs_buf.c
@@ -68,7 +68,7 @@ ktrace_t *pagebuf_trace_buf;
#endif
#ifdef PAGEBUF_LOCK_TRACKING
-# define PB_SET_OWNER(pb) ((pb)->pb_last_holder = current->pid)
+# define PB_SET_OWNER(pb) ((pb)->pb_last_holder = task_pid(current))
# define PB_CLEAR_OWNER(pb) ((pb)->pb_last_holder = -1)
# define PB_GET_OWNER(pb) ((pb)->pb_last_holder)
#else
Index: linux-2.6.15-rc1/fs/xfs/linux-2.6/xfs_linux.h
===================================================================
--- linux-2.6.15-rc1.orig/fs/xfs/linux-2.6/xfs_linux.h
+++ linux-2.6.15-rc1/fs/xfs/linux-2.6/xfs_linux.h
@@ -134,7 +134,7 @@ static inline void set_buffer_unwritten_
#define raw_smp_processor_id() smp_processor_id()
#endif
#define current_cpu() raw_smp_processor_id()
-#define current_pid() (current->pid)
+#define current_pid() (task_pid(current))
#define current_fsuid(cred) (current->fsuid)
#define current_fsgid(cred) (current->fsgid)
Index: linux-2.6.15-rc1/fs/xfs/support/debug.c
===================================================================
--- linux-2.6.15-rc1.orig/fs/xfs/support/debug.c
+++ linux-2.6.15-rc1/fs/xfs/support/debug.c
@@ -60,7 +60,7 @@ random(void)
int
get_thread_id(void)
{
- return current->pid;
+ return task_pid(current);
}
#endif /* DEBUG || INDUCE_IO_ERRROR || !NO_WANT_RANDOM */
Index: linux-2.6.15-rc1/fs/jffs2/debug.h
===================================================================
--- linux-2.6.15-rc1.orig/fs/jffs2/debug.h
+++ linux-2.6.15-rc1/fs/jffs2/debug.h
@@ -81,28 +81,28 @@
#define JFFS2_ERROR(fmt, ...) \
do { \
printk(JFFS2_ERR_MSG_PREFIX \
- " (%d) %s: " fmt, current->pid, \
+ " (%d) %s: " fmt, task_pid(current), \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
#define JFFS2_WARNING(fmt, ...) \
do { \
printk(JFFS2_WARN_MSG_PREFIX \
- " (%d) %s: " fmt, current->pid, \
+ " (%d) %s: " fmt, task_pid(current), \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
#define JFFS2_NOTICE(fmt, ...) \
do { \
printk(JFFS2_NOTICE_MSG_PREFIX \
- " (%d) %s: " fmt, current->pid, \
+ " (%d) %s: " fmt, task_pid(current), \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
#define JFFS2_DEBUG(fmt, ...) \
do { \
printk(JFFS2_DBG_MSG_PREFIX \
- " (%d) %s: " fmt, current->pid, \
+ " (%d) %s: " fmt, task_pid(current), \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 04/13] Change pid accesses: include/.
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (2 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 03/13] Change pid accesses: filesystems Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 05/13] Change pid accesses: ipc Serge E. Hallyn
` (12 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B3-change-pid-tgid-references-include --]
[-- Type: text/plain, Size: 1564 bytes --]
Replace-Subject: Change pid accesses: include/.
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses under include/.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
include/linux/reiserfs_fs.h | 2 +-
include/net/scm.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.15-rc1/include/linux/reiserfs_fs.h
===================================================================
--- linux-2.6.15-rc1.orig/include/linux/reiserfs_fs.h
+++ linux-2.6.15-rc1/include/linux/reiserfs_fs.h
@@ -83,7 +83,7 @@ void reiserfs_warning(struct super_block
if( !( cond ) ) \
reiserfs_panic( NULL, "reiserfs[%i]: assertion " #cond " failed at " \
__FILE__ ":%i:%s: " format "\n", \
- in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args )
+ in_interrupt() ? -1 : task_pid(current), __LINE__ , __FUNCTION__ , ##args )
#if defined( CONFIG_REISERFS_CHECK )
#define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args )
Index: linux-2.6.15-rc1/include/net/scm.h
===================================================================
--- linux-2.6.15-rc1.orig/include/net/scm.h
+++ linux-2.6.15-rc1/include/net/scm.h
@@ -40,7 +40,7 @@ static __inline__ int scm_send(struct so
memset(scm, 0, sizeof(*scm));
scm->creds.uid = current->uid;
scm->creds.gid = current->gid;
- scm->creds.pid = current->tgid;
+ scm->creds.pid = task_tgid(current);
if (msg->msg_controllen <= 0)
return 0;
return __scm_send(sock, msg, scm);
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 05/13] Change pid accesses: ipc
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (3 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 04/13] Change pid accesses: include/ Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 06/13] Change pid accesses: kernel/ Serge E. Hallyn
` (11 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B4-change-pid-tgid-references-ipc --]
[-- Type: text/plain, Size: 4948 bytes --]
Replace-Subject: Change pid accesses: ipc
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for ipc/.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
ipc/mqueue.c | 8 ++++----
ipc/msg.c | 6 +++---
ipc/sem.c | 8 ++++----
ipc/shm.c | 6 +++---
4 files changed, 14 insertions(+), 14 deletions(-)
Index: linux-2.6.15-rc1/ipc/mqueue.c
===================================================================
--- linux-2.6.15-rc1.orig/ipc/mqueue.c
+++ linux-2.6.15-rc1/ipc/mqueue.c
@@ -359,7 +359,7 @@ static int mqueue_flush_file(struct file
struct mqueue_inode_info *info = MQUEUE_I(filp->f_dentry->d_inode);
spin_lock(&info->lock);
- if (current->tgid == info->notify_owner)
+ if (task_tgid(current) == info->notify_owner)
remove_notification(info);
spin_unlock(&info->lock);
@@ -511,7 +511,7 @@ static void __do_notify(struct mqueue_in
sig_i.si_errno = 0;
sig_i.si_code = SI_MESGQ;
sig_i.si_value = info->notify.sigev_value;
- sig_i.si_pid = current->tgid;
+ sig_i.si_pid = task_tgid(current);
sig_i.si_uid = current->uid;
kill_proc_info(info->notify.sigev_signo,
@@ -1034,7 +1034,7 @@ retry:
ret = 0;
spin_lock(&info->lock);
if (u_notification == NULL) {
- if (info->notify_owner == current->tgid) {
+ if (info->notify_owner == task_tgid(current)) {
remove_notification(info);
inode->i_atime = inode->i_ctime = CURRENT_TIME;
}
@@ -1058,7 +1058,7 @@ retry:
info->notify.sigev_notify = SIGEV_SIGNAL;
break;
}
- info->notify_owner = current->tgid;
+ info->notify_owner = task_tgid(current);
inode->i_atime = inode->i_ctime = CURRENT_TIME;
}
spin_unlock(&info->lock);
Index: linux-2.6.15-rc1/ipc/msg.c
===================================================================
--- linux-2.6.15-rc1.orig/ipc/msg.c
+++ linux-2.6.15-rc1/ipc/msg.c
@@ -539,7 +539,7 @@ static inline int pipelined_send(struct
msr->r_msg = ERR_PTR(-E2BIG);
} else {
msr->r_msg = NULL;
- msq->q_lrpid = msr->r_tsk->pid;
+ msq->q_lrpid = task_pid(msr->r_tsk);
msq->q_rtime = get_seconds();
wake_up_process(msr->r_tsk);
smp_mb();
@@ -621,7 +621,7 @@ asmlinkage long sys_msgsnd (int msqid, s
}
}
- msq->q_lspid = current->tgid;
+ msq->q_lspid = task_tgid(current);
msq->q_stime = get_seconds();
if(!pipelined_send(msq,msg)) {
@@ -717,7 +717,7 @@ asmlinkage long sys_msgrcv (int msqid, s
list_del(&msg->m_list);
msq->q_qnum--;
msq->q_rtime = get_seconds();
- msq->q_lrpid = current->tgid;
+ msq->q_lrpid = task_tgid(current);
msq->q_cbytes -= msg->m_ts;
atomic_sub(msg->m_ts,&msg_bytes);
atomic_dec(&msg_hdrs);
Index: linux-2.6.15-rc1/ipc/sem.c
===================================================================
--- linux-2.6.15-rc1.orig/ipc/sem.c
+++ linux-2.6.15-rc1/ipc/sem.c
@@ -740,7 +740,7 @@ static int semctl_main(int semid, int se
for (un = sma->undo; un; un = un->id_next)
un->semadj[semnum] = 0;
curr->semval = val;
- curr->sempid = current->tgid;
+ curr->sempid = task_tgid(current);
sma->sem_ctime = get_seconds();
/* maybe some queued-up processes were waiting for this */
update_queue(sma);
@@ -1132,7 +1132,7 @@ retry_undos:
if (error)
goto out_unlock_free;
- error = try_atomic_semop (sma, sops, nsops, un, current->tgid);
+ error = try_atomic_semop (sma, sops, nsops, un, task_tgid(current));
if (error <= 0) {
if (alter && error == 0)
update_queue (sma);
@@ -1147,7 +1147,7 @@ retry_undos:
queue.sops = sops;
queue.nsops = nsops;
queue.undo = un;
- queue.pid = current->tgid;
+ queue.pid = task_tgid(current);
queue.id = semid;
queue.alter = alter;
if (alter)
@@ -1317,7 +1317,7 @@ found:
sem->semval = 0;
if (sem->semval > SEMVMX)
sem->semval = SEMVMX;
- sem->sempid = current->tgid;
+ sem->sempid = task_tgid(current);
}
}
sma->sem_otime = get_seconds();
Index: linux-2.6.15-rc1/ipc/shm.c
===================================================================
--- linux-2.6.15-rc1.orig/ipc/shm.c
+++ linux-2.6.15-rc1/ipc/shm.c
@@ -94,7 +94,7 @@ static inline void shm_inc (int id) {
if(!(shp = shm_lock(id)))
BUG();
shp->shm_atim = get_seconds();
- shp->shm_lprid = current->tgid;
+ shp->shm_lprid = task_tgid(current);
shp->shm_nattch++;
shm_unlock(shp);
}
@@ -144,7 +144,7 @@ static void shm_close (struct vm_area_st
/* remove from the list of attaches of the shm segment */
if(!(shp = shm_lock(id)))
BUG();
- shp->shm_lprid = current->tgid;
+ shp->shm_lprid = task_tgid(current);
shp->shm_dtim = get_seconds();
shp->shm_nattch--;
if(shp->shm_nattch == 0 &&
@@ -232,7 +232,7 @@ static int newseg (key_t key, int shmflg
if(id == -1)
goto no_id;
- shp->shm_cprid = current->tgid;
+ shp->shm_cprid = task_tgid(current);
shp->shm_lprid = 0;
shp->shm_atim = shp->shm_dtim = 0;
shp->shm_ctim = get_seconds();
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 06/13] Change pid accesses: kernel/
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (4 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 05/13] Change pid accesses: ipc Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 07/13] Change pid accesses: lib/ Serge E. Hallyn
` (10 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B5-change-pid-tgid-references-kernel --]
[-- Type: text/plain, Size: 25498 bytes --]
Replace-Subject: Change pid accesses: kernel/
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for kernel/.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
kernel/acct.c | 4 ++--
kernel/auditsc.c | 14 +++++++-------
kernel/capability.c | 8 ++++----
kernel/cpu.c | 2 +-
kernel/cpuset.c | 2 +-
kernel/exit.c | 30 +++++++++++++++---------------
kernel/fork.c | 16 ++++++++--------
kernel/futex.c | 2 +-
kernel/kexec.c | 3 ++-
kernel/pid.c | 12 ++++++------
kernel/posix-cpu-timers.c | 15 ++++++++-------
kernel/posix-timers.c | 5 +++--
kernel/ptrace.c | 2 +-
kernel/sched.c | 15 ++++++++-------
kernel/signal.c | 22 +++++++++++-----------
kernel/stop_machine.c | 2 +-
kernel/sys.c | 10 +++++-----
kernel/sysctl.c | 2 +-
kernel/timer.c | 8 ++++----
19 files changed, 89 insertions(+), 85 deletions(-)
Index: linux-2.6.15-rc1/kernel/acct.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/acct.c
+++ linux-2.6.15-rc1/kernel/acct.c
@@ -485,8 +485,8 @@ static void do_acct_process(long exitcod
ac.ac_gid16 = current->gid;
#endif
#if ACCT_VERSION==3
- ac.ac_pid = current->tgid;
- ac.ac_ppid = current->parent->tgid;
+ ac.ac_pid = task_tgid(current);
+ ac.ac_ppid = task_tgid(current->parent);
#endif
read_lock(&tasklist_lock); /* pin current->signal */
Index: linux-2.6.15-rc1/kernel/auditsc.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/auditsc.c
+++ linux-2.6.15-rc1/kernel/auditsc.c
@@ -401,7 +401,7 @@ static int audit_filter_rules(struct tas
switch (field) {
case AUDIT_PID:
- result = (tsk->pid == value);
+ result = (task_pid(tsk) == value);
break;
case AUDIT_UID:
result = (tsk->uid == value);
@@ -536,7 +536,7 @@ static enum audit_state audit_filter_sys
struct audit_entry *e;
enum audit_state state;
- if (audit_pid && tsk->tgid == audit_pid)
+ if (audit_pid && task_tgid(tsk) == audit_pid)
return AUDIT_DISABLED;
rcu_read_lock();
@@ -633,7 +633,7 @@ static inline struct audit_context *audi
context->auditable = 1;
}
- context->pid = tsk->pid;
+ context->pid = task_pid(tsk);
context->uid = tsk->uid;
context->gid = tsk->gid;
context->euid = tsk->euid;
@@ -975,7 +975,7 @@ void audit_syscall_entry(struct task_str
printk(KERN_ERR
"audit(:%d) pid=%d in syscall=%d;"
" entering syscall=%d\n",
- context->serial, tsk->pid, context->major, major);
+ context->serial, task_pid(tsk), context->major, major);
#endif
newctx = audit_alloc_context(context->state);
if (newctx) {
@@ -1179,7 +1179,7 @@ int audit_set_loginuid(struct task_struc
if (ab) {
audit_log_format(ab, "login pid=%d uid=%u "
"old auid=%u new auid=%u",
- task->pid, task->uid,
+ task_pid(task), task->uid,
task->audit_context->loginuid, loginuid);
audit_log_end(ab);
}
@@ -1284,10 +1284,10 @@ void audit_signal_info(int sig, struct t
extern pid_t audit_sig_pid;
extern uid_t audit_sig_uid;
- if (unlikely(audit_pid && t->tgid == audit_pid)) {
+ if (unlikely(audit_pid && task_tgid(t) == audit_pid)) {
if (sig == SIGTERM || sig == SIGHUP) {
struct audit_context *ctx = current->audit_context;
- audit_sig_pid = current->pid;
+ audit_sig_pid = task_pid(current);
if (ctx)
audit_sig_uid = ctx->loginuid;
else
Index: linux-2.6.15-rc1/kernel/capability.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/capability.c
+++ linux-2.6.15-rc1/kernel/capability.c
@@ -66,7 +66,7 @@ asmlinkage long sys_capget(cap_user_head
spin_lock(&task_capability_lock);
read_lock(&tasklist_lock);
- if (pid && pid != current->pid) {
+ if (pid && pid != task_pid(current)) {
target = find_task_by_pid(pid);
if (!target) {
ret = -ESRCH;
@@ -132,7 +132,7 @@ static inline int cap_set_all(kernel_cap
int found = 0;
do_each_thread(g, target) {
- if (target == current || target->pid == 1)
+ if (target == current || task_pid(target) == 1)
continue;
found = 1;
if (security_capset_check(target, effective, inheritable,
@@ -187,7 +187,7 @@ asmlinkage long sys_capset(cap_user_head
if (get_user(pid, &header->pid))
return -EFAULT;
- if (pid && pid != current->pid && !capable(CAP_SETPCAP))
+ if (pid && pid != task_pid(current) && !capable(CAP_SETPCAP))
return -EPERM;
if (copy_from_user(&effective, &data->effective, sizeof(effective)) ||
@@ -198,7 +198,7 @@ asmlinkage long sys_capset(cap_user_head
spin_lock(&task_capability_lock);
read_lock(&tasklist_lock);
- if (pid > 0 && pid != current->pid) {
+ if (pid > 0 && pid != task_pid(current)) {
target = find_task_by_pid(pid);
if (!target) {
ret = -ESRCH;
Index: linux-2.6.15-rc1/kernel/cpu.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/cpu.c
+++ linux-2.6.15-rc1/kernel/cpu.c
@@ -72,7 +72,7 @@ static inline void check_for_tasks(int c
!cputime_eq(p->stime, cputime_zero)))
printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\
(state = %ld, flags = %lx) \n",
- p->comm, p->pid, cpu, p->state, p->flags);
+ p->comm, task_pid(p), cpu, p->state, p->flags);
}
write_unlock_irq(&tasklist_lock);
}
Index: linux-2.6.15-rc1/kernel/cpuset.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/cpuset.c
+++ linux-2.6.15-rc1/kernel/cpuset.c
@@ -1261,7 +1261,7 @@ static inline int pid_array_load(pid_t *
do_each_thread(g, p) {
if (p->cpuset == cs) {
- pidarray[n++] = p->pid;
+ pidarray[n++] = task_pid(p);
if (unlikely(n == npids))
goto array_full;
}
Index: linux-2.6.15-rc1/kernel/exit.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/exit.c
+++ linux-2.6.15-rc1/kernel/exit.c
@@ -50,7 +50,7 @@ static void __unhash_process(struct task
if (thread_group_leader(p)) {
detach_pid(p, PIDTYPE_PGID);
detach_pid(p, PIDTYPE_SID);
- if (p->pid)
+ if (task_pid(p))
__get_cpu_var(process_counts)--;
}
@@ -170,7 +170,7 @@ static int will_become_orphaned_pgrp(int
do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
if (p == ignored_task
|| p->exit_state
- || p->real_parent->pid == 1)
+ || task_pid(p->real_parent) == 1)
continue;
if (process_group(p->real_parent) != pgrp
&& p->real_parent->signal->session == p->signal->session) {
@@ -797,9 +797,9 @@ fastcall NORET_TYPE void do_exit(long co
if (unlikely(in_interrupt()))
panic("Aiee, killing interrupt handler!");
- if (unlikely(!tsk->pid))
+ if (unlikely(!task_pid(tsk)))
panic("Attempted to kill the idle task!");
- if (unlikely(tsk->pid == 1))
+ if (unlikely(task_pid(tsk) == 1))
panic("Attempted to kill init!");
if (tsk->io_context)
exit_io_context();
@@ -832,7 +832,7 @@ fastcall NORET_TYPE void do_exit(long co
if (unlikely(in_atomic()))
printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
preempt_count());
acct_update_integrals(tsk);
@@ -951,7 +951,7 @@ asmlinkage void sys_exit_group(int error
static int eligible_child(pid_t pid, int options, task_t *p)
{
if (pid > 0) {
- if (p->pid != pid)
+ if (task_pid(p) != pid)
return 0;
} else if (!pid) {
if (process_group(p) != process_group(current))
@@ -980,7 +980,7 @@ static int eligible_child(pid_t pid, int
* Do not consider thread group leaders that are
* in a non-empty thread group:
*/
- if (current->tgid != p->tgid && delay_group_leader(p))
+ if (task_tgid(current) != task_tgid(p) && delay_group_leader(p))
return 2;
if (security_task_wait(p))
@@ -1028,7 +1028,7 @@ static int wait_task_zombie(task_t *p, i
int status;
if (unlikely(noreap)) {
- pid_t pid = p->pid;
+ pid_t pid = task_pid(p);
uid_t uid = p->uid;
int exit_code = p->exit_code;
int why, status;
@@ -1135,7 +1135,7 @@ static int wait_task_zombie(task_t *p, i
retval = put_user(status, &infop->si_status);
}
if (!retval && infop)
- retval = put_user(p->pid, &infop->si_pid);
+ retval = put_user(task_pid(p), &infop->si_pid);
if (!retval && infop)
retval = put_user(p->uid, &infop->si_uid);
if (retval) {
@@ -1143,7 +1143,7 @@ static int wait_task_zombie(task_t *p, i
p->exit_state = EXIT_ZOMBIE;
return retval;
}
- retval = p->pid;
+ retval = task_pid(p);
if (p->real_parent != p->parent) {
write_lock_irq(&tasklist_lock);
/* Double-check with lock held. */
@@ -1203,7 +1203,7 @@ static int wait_task_stopped(task_t *p,
read_unlock(&tasklist_lock);
if (unlikely(noreap)) {
- pid_t pid = p->pid;
+ pid_t pid = task_pid(p);
uid_t uid = p->uid;
int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;
@@ -1274,11 +1274,11 @@ bail_ref:
if (!retval && infop)
retval = put_user(exit_code, &infop->si_status);
if (!retval && infop)
- retval = put_user(p->pid, &infop->si_pid);
+ retval = put_user(task_pid(p), &infop->si_pid);
if (!retval && infop)
retval = put_user(p->uid, &infop->si_uid);
if (!retval)
- retval = p->pid;
+ retval = task_pid(p);
put_task_struct(p);
BUG_ON(!retval);
@@ -1315,7 +1315,7 @@ static int wait_task_continued(task_t *p
p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
spin_unlock_irq(&p->sighand->siglock);
- pid = p->pid;
+ pid = task_pid(p);
uid = p->uid;
get_task_struct(p);
read_unlock(&tasklist_lock);
@@ -1326,7 +1326,7 @@ static int wait_task_continued(task_t *p
if (!retval && stat_addr)
retval = put_user(0xffff, stat_addr);
if (!retval)
- retval = p->pid;
+ retval = task_pid(p);
} else {
retval = wait_noreap_copyout(p, pid, uid,
CLD_CONTINUED, SIGCONT,
Index: linux-2.6.15-rc1/kernel/fork.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/fork.c
+++ linux-2.6.15-rc1/kernel/fork.c
@@ -850,7 +850,7 @@ asmlinkage long sys_set_tid_address(int
{
current->clear_child_tid = tidptr;
- return current->pid;
+ return task_pid(current);
}
/*
@@ -927,10 +927,10 @@ static task_t *copy_process(unsigned lon
p->did_exec = 0;
copy_flags(clone_flags, p);
- p->pid = pid;
+ p->__pid = pid;
retval = -EFAULT;
if (clone_flags & CLONE_PARENT_SETTID)
- if (put_user(p->pid, parent_tidptr))
+ if (put_user(task_pid(p), parent_tidptr))
goto bad_fork_cleanup;
p->proc_dentry = NULL;
@@ -975,9 +975,9 @@ static task_t *copy_process(unsigned lon
}
#endif
- p->tgid = p->pid;
+ p->__tgid = task_pid(p);
if (clone_flags & CLONE_THREAD)
- p->tgid = current->tgid;
+ p->__tgid = task_tgid(current);
if ((retval = security_task_alloc(p)))
goto bad_fork_cleanup_policy;
@@ -1128,12 +1128,12 @@ static task_t *copy_process(unsigned lon
cpuset_fork(p);
- attach_pid(p, PIDTYPE_PID, p->pid);
- attach_pid(p, PIDTYPE_TGID, p->tgid);
+ attach_pid(p, PIDTYPE_PID, task_pid(p));
+ attach_pid(p, PIDTYPE_TGID, task_tgid(p));
if (thread_group_leader(p)) {
attach_pid(p, PIDTYPE_PGID, process_group(p));
attach_pid(p, PIDTYPE_SID, p->signal->session);
- if (p->pid)
+ if (task_pid(p))
__get_cpu_var(process_counts)++;
}
Index: linux-2.6.15-rc1/kernel/futex.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/futex.c
+++ linux-2.6.15-rc1/kernel/futex.c
@@ -789,7 +789,7 @@ static int futex_fd(unsigned long uaddr,
filp->f_mapping = filp->f_dentry->d_inode->i_mapping;
if (signal) {
- err = f_setown(filp, current->pid, 1);
+ err = f_setown(filp, task_pid(current), 1);
if (err < 0) {
goto error;
}
Index: linux-2.6.15-rc1/kernel/kexec.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/kexec.c
+++ linux-2.6.15-rc1/kernel/kexec.c
@@ -36,7 +36,8 @@ struct resource crashk_res = {
int kexec_should_crash(struct task_struct *p)
{
- if (in_interrupt() || !p->pid || p->pid == 1 || panic_on_oops)
+ if (in_interrupt() || !task_pid(p) ||
+ task_pid(p) == 1 || panic_on_oops)
return 1;
return 0;
}
Index: linux-2.6.15-rc1/kernel/pid.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/pid.c
+++ linux-2.6.15-rc1/kernel/pid.c
@@ -232,17 +232,17 @@ void switch_exec_pids(task_t *leader, ta
__detach_pid(thread, PIDTYPE_PID);
__detach_pid(thread, PIDTYPE_TGID);
- leader->pid = leader->tgid = thread->pid;
- thread->pid = thread->tgid;
+ leader->__pid = leader->__tgid = thread->__pid;
+ thread->__pid = thread->__tgid;
- attach_pid(thread, PIDTYPE_PID, thread->pid);
- attach_pid(thread, PIDTYPE_TGID, thread->tgid);
+ attach_pid(thread, PIDTYPE_PID, thread->__pid);
+ attach_pid(thread, PIDTYPE_TGID, thread->__tgid);
attach_pid(thread, PIDTYPE_PGID, thread->signal->pgrp);
attach_pid(thread, PIDTYPE_SID, thread->signal->session);
list_add_tail(&thread->tasks, &init_task.tasks);
- attach_pid(leader, PIDTYPE_PID, leader->pid);
- attach_pid(leader, PIDTYPE_TGID, leader->tgid);
+ attach_pid(leader, PIDTYPE_PID, leader->__pid);
+ attach_pid(leader, PIDTYPE_TGID, leader->__tgid);
attach_pid(leader, PIDTYPE_PGID, leader->signal->pgrp);
attach_pid(leader, PIDTYPE_SID, leader->signal->session);
}
Index: linux-2.6.15-rc1/kernel/posix-cpu-timers.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/posix-cpu-timers.c
+++ linux-2.6.15-rc1/kernel/posix-cpu-timers.c
@@ -22,7 +22,8 @@ static int check_clock(clockid_t which_c
read_lock(&tasklist_lock);
p = find_task_by_pid(pid);
if (!p || (CPUCLOCK_PERTHREAD(which_clock) ?
- p->tgid != current->tgid : p->tgid != pid)) {
+ task_tgid(p) != task_tgid(current)
+ : task_tgid(p) != pid)) {
error = -EINVAL;
}
read_unlock(&tasklist_lock);
@@ -238,7 +239,7 @@ static int cpu_clock_sample_group_locked
while ((t = next_thread(t)) != p) {
cpu->sched += t->sched_time;
}
- if (p->tgid == current->tgid) {
+ if (task_tgid(p) == task_tgid(current)) {
/*
* We're sampling ourselves, so include the
* cycles not yet banked. We still omit
@@ -306,11 +307,11 @@ int posix_cpu_clock_get(clockid_t which_
p = find_task_by_pid(pid);
if (p) {
if (CPUCLOCK_PERTHREAD(which_clock)) {
- if (p->tgid == current->tgid) {
+ if (task_tgid(p) == task_tgid(current)) {
error = cpu_clock_sample(which_clock,
p, &rtn);
}
- } else if (p->tgid == pid && p->signal) {
+ } else if (task_tgid(p) == pid && p->signal) {
error = cpu_clock_sample_group(which_clock,
p, &rtn);
}
@@ -348,7 +349,7 @@ int posix_cpu_timer_create(struct k_itim
p = current;
} else {
p = find_task_by_pid(pid);
- if (p && p->tgid != current->tgid)
+ if (p && task_tgid(p) != task_tgid(current))
p = NULL;
}
} else {
@@ -356,7 +357,7 @@ int posix_cpu_timer_create(struct k_itim
p = current->group_leader;
} else {
p = find_task_by_pid(pid);
- if (p && p->tgid != pid)
+ if (p && task_tgid(p) != pid)
p = NULL;
}
}
@@ -1423,7 +1424,7 @@ int posix_cpu_nsleep(clockid_t which_clo
*/
if (CPUCLOCK_PERTHREAD(which_clock) &&
(CPUCLOCK_PID(which_clock) == 0 ||
- CPUCLOCK_PID(which_clock) == current->pid))
+ CPUCLOCK_PID(which_clock) == task_pid(current)))
return -EINVAL;
/*
Index: linux-2.6.15-rc1/kernel/posix-timers.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/posix-timers.c
+++ linux-2.6.15-rc1/kernel/posix-timers.c
@@ -519,7 +519,7 @@ static inline struct task_struct * good_
if ((event->sigev_notify & SIGEV_THREAD_ID ) &&
(!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) ||
- rtn->tgid != current->tgid ||
+ task_tgid(rtn) != task_tgid(current) ||
(event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))
return NULL;
@@ -747,7 +747,8 @@ static struct k_itimer * lock_timer(time
spin_unlock(&idr_lock);
if ((timr->it_id != timer_id) || !(timr->it_process) ||
- timr->it_process->tgid != current->tgid) {
+ task_tgid(timr->it_process) !=
+ task_tgid(current)) {
unlock_timer(timr, *flags);
timr = NULL;
}
Index: linux-2.6.15-rc1/kernel/ptrace.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/ptrace.c
+++ linux-2.6.15-rc1/kernel/ptrace.c
@@ -153,7 +153,7 @@ int ptrace_attach(struct task_struct *ta
int retval;
task_lock(task);
retval = -EPERM;
- if (task->pid <= 1)
+ if (task_pid(task) <= 1)
goto bad;
if (task->tgid == current->tgid)
goto bad;
Index: linux-2.6.15-rc1/kernel/sched.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/sched.c
+++ linux-2.6.15-rc1/kernel/sched.c
@@ -1653,7 +1653,7 @@ asmlinkage void schedule_tail(task_t *pr
preempt_enable();
#endif
if (current->set_child_tid)
- put_user(current->pid, current->set_child_tid);
+ put_user(task_pid(current), current->set_child_tid);
}
/*
@@ -2961,7 +2961,7 @@ asmlinkage void __sched schedule(void)
if (unlikely(in_atomic())) {
printk(KERN_ERR "scheduling while atomic: "
"%s/0x%08x/%d\n",
- current->comm, preempt_count(), current->pid);
+ current->comm, preempt_count(), task_pid(current));
dump_stack();
}
}
@@ -4333,17 +4333,18 @@ static void show_task(task_t *p)
free = (unsigned long) n - (unsigned long)(p->thread_info+1);
}
#endif
- printk("%5lu %5d %6d ", free, p->pid, p->parent->pid);
+ printk("%5lu %5d %6d ", free, task_pid(p),
+ task_pid(p->parent));
if ((relative = eldest_child(p)))
- printk("%5d ", relative->pid);
+ printk("%5d ", task_pid(relative));
else
printk(" ");
if ((relative = younger_sibling(p)))
- printk("%7d", relative->pid);
+ printk("%7d", task_pid(relative));
else
printk(" ");
if ((relative = older_sibling(p)))
- printk(" %5d", relative->pid);
+ printk(" %5d", task_pid(relative));
else
printk(" ");
if (!p->mm)
@@ -4623,7 +4624,7 @@ static void move_task_off_dead_cpu(int d
if (tsk->mm && printk_ratelimit())
printk(KERN_INFO "process %d (%s) no "
"longer affine to cpu%d\n",
- tsk->pid, tsk->comm, dead_cpu);
+ task_pid(tsk), tsk->comm, dead_cpu);
}
__migrate_task(tsk, dead_cpu, dest_cpu);
}
Index: linux-2.6.15-rc1/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/signal.c
+++ linux-2.6.15-rc1/kernel/signal.c
@@ -809,7 +809,7 @@ static int send_signal(int sig, struct s
q->info.si_signo = sig;
q->info.si_errno = 0;
q->info.si_code = SI_USER;
- q->info.si_pid = current->pid;
+ q->info.si_pid = task_pid(current);
q->info.si_uid = current->uid;
break;
case (unsigned long) SEND_SIG_PRIV:
@@ -946,7 +946,7 @@ __group_complete_signal(int sig, struct
if (t == NULL)
/* restart balancing at this thread */
t = p->signal->curr_target = p;
- BUG_ON(t->tgid != p->tgid);
+ BUG_ON(task_tgid(t) != task_tgid(p));
while (!wants_signal(sig, t)) {
t = next_thread(t);
@@ -1208,7 +1208,7 @@ static int kill_something_info(int sig,
read_lock(&tasklist_lock);
for_each_process(p) {
- if (p->pid > 1 && p->tgid != current->tgid) {
+ if (task_pid(p) > 1 && task_tgid(p) != task_tgid(current)) {
int err = group_send_sig_info(sig, info, p);
++count;
if (err != -EPERM)
@@ -1478,7 +1478,7 @@ void do_notify_parent(struct task_struct
info.si_signo = sig;
info.si_errno = 0;
- info.si_pid = tsk->pid;
+ info.si_pid = task_pid(tsk);
info.si_uid = tsk->uid;
/* FIXME: find out whether or not this is supposed to be c*time. */
@@ -1543,7 +1543,7 @@ static void do_notify_parent_cldstop(str
info.si_signo = SIGCHLD;
info.si_errno = 0;
- info.si_pid = tsk->pid;
+ info.si_pid = task_pid(tsk);
info.si_uid = tsk->uid;
/* FIXME: find out whether or not this is supposed to be c*time. */
@@ -1646,7 +1646,7 @@ void ptrace_notify(int exit_code)
memset(&info, 0, sizeof info);
info.si_signo = SIGTRAP;
info.si_code = exit_code;
- info.si_pid = current->pid;
+ info.si_pid = task_pid(current);
info.si_uid = current->uid;
/* Let the debugger run. */
@@ -1871,7 +1871,7 @@ relock:
info->si_signo = signr;
info->si_errno = 0;
info->si_code = SI_USER;
- info->si_pid = current->parent->pid;
+ info->si_pid = task_pid(current->parent);
info->si_uid = current->parent->uid;
}
@@ -1902,7 +1902,7 @@ relock:
continue;
/* Init gets no signals it doesn't want. */
- if (current->pid == 1)
+ if (task_pid(current) == 1)
continue;
if (sig_kernel_stop(signr)) {
@@ -2254,7 +2254,7 @@ sys_kill(int pid, int sig)
info.si_signo = sig;
info.si_errno = 0;
info.si_code = SI_USER;
- info.si_pid = current->tgid;
+ info.si_pid = task_tgid(current);
info.si_uid = current->uid;
return kill_something_info(sig, &info, pid);
@@ -2270,12 +2270,12 @@ static int do_tkill(int tgid, int pid, i
info.si_signo = sig;
info.si_errno = 0;
info.si_code = SI_TKILL;
- info.si_pid = current->tgid;
+ info.si_pid = task_tgid(current);
info.si_uid = current->uid;
read_lock(&tasklist_lock);
p = find_task_by_pid(pid);
- if (p && (tgid <= 0 || p->tgid == tgid)) {
+ if (p && (tgid <= 0 || task_tgid(p) == tgid)) {
error = check_kill_permission(sig, &info, p);
/*
* The null signal is a permissions and process existence
Index: linux-2.6.15-rc1/kernel/stop_machine.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/stop_machine.c
+++ linux-2.6.15-rc1/kernel/stop_machine.c
@@ -91,7 +91,7 @@ static int stop_machine(void)
/* One high-prio thread per cpu. We'll do this one. */
set_fs(KERNEL_DS);
- sys_sched_setscheduler(current->pid, SCHED_FIFO,
+ sys_sched_setscheduler(task_pid(current), SCHED_FIFO,
(struct sched_param __user *)¶m);
set_fs(old_fs);
Index: linux-2.6.15-rc1/kernel/sys.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/sys.c
+++ linux-2.6.15-rc1/kernel/sys.c
@@ -267,7 +267,7 @@ asmlinkage long sys_setpriority(int whic
switch (which) {
case PRIO_PROCESS:
if (!who)
- who = current->pid;
+ who = task_pid(current);
p = find_task_by_pid(who);
if (p)
error = set_one_prio(p, niceval, error);
@@ -320,7 +320,7 @@ asmlinkage long sys_getpriority(int whic
switch (which) {
case PRIO_PROCESS:
if (!who)
- who = current->pid;
+ who = task_pid(current);
p = find_task_by_pid(who);
if (p) {
niceval = 20 - task_nice(p);
@@ -1086,7 +1086,7 @@ asmlinkage long sys_setpgid(pid_t pid, p
int err = -EINVAL;
if (!pid)
- pid = current->pid;
+ pid = task_pid(current);
if (!pgid)
pgid = pid;
if (pgid < 0)
@@ -1216,12 +1216,12 @@ asmlinkage long sys_setsid(void)
down(&tty_sem);
write_lock_irq(&tasklist_lock);
- pid = find_pid(PIDTYPE_PGID, current->pid);
+ pid = find_pid(PIDTYPE_PGID, task_pid(current));
if (pid)
goto out;
current->signal->leader = 1;
- __set_special_pids(current->pid, current->pid);
+ __set_special_pids(task_pid(current), task_pid(current));
current->signal->tty = NULL;
current->signal->tty_old_pgrp = 0;
err = process_group(current);
Index: linux-2.6.15-rc1/kernel/sysctl.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/sysctl.c
+++ linux-2.6.15-rc1/kernel/sysctl.c
@@ -1764,7 +1764,7 @@ int proc_dointvec_bset(ctl_table *table,
return -EPERM;
}
- op = (current->pid == 1) ? OP_SET : OP_AND;
+ op = (task_pid(current) == 1) ? OP_SET : OP_AND;
return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
do_proc_dointvec_bset_conv,&op);
}
Index: linux-2.6.15-rc1/kernel/timer.c
===================================================================
--- linux-2.6.15-rc1.orig/kernel/timer.c
+++ linux-2.6.15-rc1/kernel/timer.c
@@ -937,11 +937,11 @@ asmlinkage unsigned long sys_alarm(unsig
* the pid are identical unless CLONE_THREAD was specified on clone() in
* which case the tgid is the same in all threads of the same group.
*
- * This is SMP safe as current->tgid does not change.
+ * This is SMP safe as task_tgid(current) does not change.
*/
asmlinkage long sys_getpid(void)
{
- return current->tgid;
+ return task_tgid(current);
}
/*
@@ -968,7 +968,7 @@ asmlinkage long sys_getppid(void)
parent = me->group_leader->real_parent;
for (;;) {
- pid = parent->tgid;
+ pid = task_tgid(parent);
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
{
struct task_struct *old = parent;
@@ -1115,7 +1115,7 @@ EXPORT_SYMBOL(schedule_timeout_uninterru
/* Thread ID - the internal kernel "pid" */
asmlinkage long sys_gettid(void)
{
- return current->pid;
+ return task_pid(current);
}
static long __sched nanosleep_restart(struct restart_block *restart)
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 07/13] Change pid accesses: lib/
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (5 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 06/13] Change pid accesses: kernel/ Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 08/13] Change pid accesses: mm/ Serge E. Hallyn
` (9 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B6-change-pid-tgid-references-lib --]
[-- Type: text/plain, Size: 4035 bytes --]
Replace-Subject: Change pid accesses: lib/
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses under lib/.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
lib/rwsem-spinlock.c | 2 +-
lib/rwsem.c | 2 +-
lib/smp_processor_id.c | 2 +-
lib/spinlock_debug.c | 12 ++++++------
4 files changed, 9 insertions(+), 9 deletions(-)
Index: linux-2.6.15-rc1/lib/rwsem-spinlock.c
===================================================================
--- linux-2.6.15-rc1.orig/lib/rwsem-spinlock.c
+++ linux-2.6.15-rc1/lib/rwsem-spinlock.c
@@ -22,7 +22,7 @@ void rwsemtrace(struct rw_semaphore *sem
{
if (sem->debug)
printk("[%d] %s({%d,%d})\n",
- current->pid, str, sem->activity,
+ task_pid(current), str, sem->activity,
list_empty(&sem->wait_list) ? 0 : 1);
}
#endif
Index: linux-2.6.15-rc1/lib/rwsem.c
===================================================================
--- linux-2.6.15-rc1.orig/lib/rwsem.c
+++ linux-2.6.15-rc1/lib/rwsem.c
@@ -23,7 +23,7 @@ void rwsemtrace(struct rw_semaphore *sem
printk("sem=%p\n", sem);
printk("(sem)=%08lx\n", sem->count);
if (sem->debug)
- printk("[%d] %s({%08lx})\n", current->pid, str, sem->count);
+ printk("[%d] %s({%08lx})\n", task_pid(current), str, sem->count);
}
#endif
Index: linux-2.6.15-rc1/lib/smp_processor_id.c
===================================================================
--- linux-2.6.15-rc1.orig/lib/smp_processor_id.c
+++ linux-2.6.15-rc1/lib/smp_processor_id.c
@@ -42,7 +42,7 @@ unsigned int debug_smp_processor_id(void
if (!printk_ratelimit())
goto out_enable;
- printk(KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n", preempt_count(), current->comm, current->pid);
+ printk(KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n", preempt_count(), current->comm, task_pid(current));
print_symbol("caller is %s\n", (long)__builtin_return_address(0));
dump_stack();
Index: linux-2.6.15-rc1/lib/spinlock_debug.c
===================================================================
--- linux-2.6.15-rc1.orig/lib/spinlock_debug.c
+++ linux-2.6.15-rc1/lib/spinlock_debug.c
@@ -20,11 +20,11 @@ static void spin_bug(spinlock_t *lock, c
if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
owner = lock->owner;
printk("BUG: spinlock %s on CPU#%d, %s/%d\n",
- msg, smp_processor_id(), current->comm, current->pid);
+ msg, smp_processor_id(), current->comm, task_pid(current));
printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n",
lock, lock->magic,
owner ? owner->comm : "<none>",
- owner ? owner->pid : -1,
+ owner ? task_pid(owner) : -1,
lock->owner_cpu);
dump_stack();
#ifdef CONFIG_SMP
@@ -78,7 +78,7 @@ static void __spin_lock_debug(spinlock_t
if (print_once) {
print_once = 0;
printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n",
- smp_processor_id(), current->comm, current->pid,
+ smp_processor_id(), current->comm, task_pid(current),
lock);
dump_stack();
}
@@ -120,7 +120,7 @@ static void rwlock_bug(rwlock_t *lock, c
if (xchg(&print_once, 0)) {
printk("BUG: rwlock %s on CPU#%d, %s/%d, %p\n", msg,
- smp_processor_id(), current->comm, current->pid, lock);
+ smp_processor_id(), current->comm, task_pid(current), lock);
dump_stack();
#ifdef CONFIG_SMP
/*
@@ -148,7 +148,7 @@ static void __read_lock_debug(rwlock_t *
if (print_once) {
print_once = 0;
printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n",
- smp_processor_id(), current->comm, current->pid,
+ smp_processor_id(), current->comm, task_pid(current),
lock);
dump_stack();
}
@@ -220,7 +220,7 @@ static void __write_lock_debug(rwlock_t
if (print_once) {
print_once = 0;
printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n",
- smp_processor_id(), current->comm, current->pid,
+ smp_processor_id(), current->comm, task_pid(current),
lock);
dump_stack();
}
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 08/13] Change pid accesses: mm/
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (6 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 07/13] Change pid accesses: lib/ Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 09/13] Change pid accesses: net/ Serge E. Hallyn
` (8 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B7-change-pid-tgid-references-mm --]
[-- Type: text/plain, Size: 3827 bytes --]
Replace-Subject: Change pid accesses: mm/
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for mm/.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
mm/nommu.c | 14 +++++++-------
mm/oom_kill.c | 10 +++++-----
2 files changed, 12 insertions(+), 12 deletions(-)
Index: linux-2.6.15-rc1/mm/nommu.c
===================================================================
--- linux-2.6.15-rc1.orig/mm/nommu.c
+++ linux-2.6.15-rc1/mm/nommu.c
@@ -264,7 +264,7 @@ static void show_process_blocks(void)
{
struct vm_list_struct *vml;
- printk("Process blocks %d:", current->pid);
+ printk("Process blocks %d:", task_pid(current));
for (vml = ¤t->mm->context.vmlist; vml; vml = vml->next) {
printk(" %p: %p", vml, vml->vma);
@@ -380,7 +380,7 @@ static int validate_mmap_request(struct
if (flags & MAP_FIXED || addr) {
printk(KERN_DEBUG
"%d: Can't do fixed-address/overlay mmap of RAM\n",
- current->pid);
+ task_pid(current));
return -EINVAL;
}
@@ -626,7 +626,7 @@ static int do_mmap_private(struct vm_are
#ifdef WARN_ON_SLACK
if (len + WARN_ON_SLACK <= kobjsize(result))
printk("Allocation of %lu bytes from process %d has %lu bytes of slack\n",
- len, current->pid, kobjsize(result) - len);
+ len, task_pid(current), kobjsize(result) - len);
#endif
if (vma->vm_file) {
@@ -663,7 +663,7 @@ error_free:
enomem:
printk("Allocation of length %lu from process %d failed\n",
- len, current->pid);
+ len, task_pid(current));
show_free_areas();
return -ENOMEM;
}
@@ -855,13 +855,13 @@ unsigned long do_mmap_pgoff(struct file
up_write(&nommu_vma_sem);
kfree(vml);
printk("Allocation of vma for %lu byte allocation from process %d failed\n",
- len, current->pid);
+ len, task_pid(current));
show_free_areas();
return -ENOMEM;
error_getting_vml:
printk("Allocation of vml for %lu byte allocation from process %d failed\n",
- len, current->pid);
+ len, task_pid(current));
show_free_areas();
return -ENOMEM;
}
@@ -915,7 +915,7 @@ int do_munmap(struct mm_struct *mm, unsi
goto found;
printk("munmap of non-mmaped memory by process %d (%s): %p\n",
- current->pid, current->comm, (void *) addr);
+ task_pid(current), current->comm, (void *) addr);
return -EINVAL;
found:
Index: linux-2.6.15-rc1/mm/oom_kill.c
===================================================================
--- linux-2.6.15-rc1.orig/mm/oom_kill.c
+++ linux-2.6.15-rc1/mm/oom_kill.c
@@ -125,7 +125,7 @@ unsigned long badness(struct task_struct
#ifdef DEBUG
printk(KERN_DEBUG "OOMkill: task %d (%s) got %d points\n",
- p->pid, p->comm, points);
+ task_pid(p), p->comm, points);
#endif
return points;
}
@@ -149,7 +149,7 @@ static struct task_struct * select_bad_p
int releasing;
/* skip the init task with pid == 1 */
- if (p->pid == 1)
+ if (task_pid(p) == 1)
continue;
if (p->oomkilladj == OOM_DISABLE)
continue;
@@ -184,7 +184,7 @@ static struct task_struct * select_bad_p
*/
static void __oom_kill_task(task_t *p)
{
- if (p->pid == 1) {
+ if (task_pid(p) == 1) {
WARN_ON(1);
printk(KERN_WARNING "tried to kill init!\n");
return;
@@ -199,7 +199,7 @@ static void __oom_kill_task(task_t *p)
}
task_unlock(p);
printk(KERN_ERR "Out of Memory: Killed process %d (%s).\n",
- p->pid, p->comm);
+ task_pid(p), p->comm);
/*
* We give our sacrificial lamb high priority and access to
@@ -230,7 +230,7 @@ static struct mm_struct *oom_kill_task(t
* but are in a different thread group
*/
do_each_thread(g, q)
- if (q->mm == mm && q->tgid != p->tgid)
+ if (q->mm == mm && task_tgid(q) != task_tgid(p))
__oom_kill_task(q);
while_each_thread(g, q);
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 09/13] Change pid accesses: net/
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (7 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 08/13] Change pid accesses: mm/ Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 10/13] Change pid accesses: security/ Serge E. Hallyn
` (7 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B8-change-pid-tgid-references-net --]
[-- Type: text/plain, Size: 10950 bytes --]
Replace-Subject: Change pid accesses: net/
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for net/.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
net/core/pktgen.c | 4 ++--
net/core/rtnetlink.c | 3 ++-
net/core/scm.c | 2 +-
net/ipv4/devinet.c | 2 +-
net/ipv4/fib_semantics.c | 2 +-
net/ipv4/ipvs/ip_vs_sync.c | 6 +++---
net/ipv4/tcp.c | 2 +-
net/ipv6/addrconf.c | 6 +++---
net/ipv6/ip6_flowlabel.c | 2 +-
net/ipv6/route.c | 2 +-
net/netlink/af_netlink.c | 2 +-
net/rxrpc/krxiod.c | 2 +-
net/rxrpc/krxsecd.c | 2 +-
net/rxrpc/krxtimod.c | 2 +-
net/sunrpc/sched.c | 2 +-
net/unix/af_unix.c | 6 +++---
16 files changed, 24 insertions(+), 23 deletions(-)
Index: linux-2.6.15-rc1/net/core/pktgen.c
===================================================================
--- linux-2.6.15-rc1.orig/net/core/pktgen.c
+++ linux-2.6.15-rc1/net/core/pktgen.c
@@ -2699,9 +2699,9 @@ static void pktgen_thread_worker(struct
t->control &= ~(T_STOP);
t->control &= ~(T_REMDEV);
- t->pid = current->pid;
+ t->pid = task_pid(current);
- PG_DEBUG(printk("pktgen: starting pktgen/%d: pid=%d\n", cpu, current->pid));
+ PG_DEBUG(printk("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid(current)));
max_before_softirq = t->max_before_softirq;
Index: linux-2.6.15-rc1/net/core/rtnetlink.c
===================================================================
--- linux-2.6.15-rc1.orig/net/core/rtnetlink.c
+++ linux-2.6.15-rc1/net/core/rtnetlink.c
@@ -455,7 +455,8 @@ void rtmsg_ifinfo(int type, struct net_d
if (!skb)
return;
- if (rtnetlink_fill_ifinfo(skb, dev, type, current->pid, 0, change, 0) < 0) {
+ if (rtnetlink_fill_ifinfo(skb, dev, type, task_pid(current),
+ 0, change, 0) < 0) {
kfree_skb(skb);
return;
}
Index: linux-2.6.15-rc1/net/core/scm.c
===================================================================
--- linux-2.6.15-rc1.orig/net/core/scm.c
+++ linux-2.6.15-rc1/net/core/scm.c
@@ -41,7 +41,7 @@
static __inline__ int scm_check_creds(struct ucred *creds)
{
- if ((creds->pid == current->tgid || capable(CAP_SYS_ADMIN)) &&
+ if ((creds->pid == task_tgid(current) || capable(CAP_SYS_ADMIN)) &&
((creds->uid == current->uid || creds->uid == current->euid ||
creds->uid == current->suid) || capable(CAP_SETUID)) &&
((creds->gid == current->gid || creds->gid == current->egid ||
Index: linux-2.6.15-rc1/net/ipv4/devinet.c
===================================================================
--- linux-2.6.15-rc1.orig/net/ipv4/devinet.c
+++ linux-2.6.15-rc1/net/ipv4/devinet.c
@@ -1113,7 +1113,7 @@ static void rtmsg_ifa(int event, struct
if (!skb)
netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS);
- else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
+ else if (inet_fill_ifaddr(skb, ifa, task_pid(current), 0, event, 0) < 0) {
kfree_skb(skb);
netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL);
} else {
Index: linux-2.6.15-rc1/net/ipv4/fib_semantics.c
===================================================================
--- linux-2.6.15-rc1.orig/net/ipv4/fib_semantics.c
+++ linux-2.6.15-rc1/net/ipv4/fib_semantics.c
@@ -1043,7 +1043,7 @@ fib_convert_rtentry(int cmd, struct nlms
}
nl->nlmsg_flags = NLM_F_REQUEST;
- nl->nlmsg_pid = current->pid;
+ nl->nlmsg_pid = task_pid(current);
nl->nlmsg_seq = 0;
nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm));
if (cmd == SIOCDELRT) {
Index: linux-2.6.15-rc1/net/ipv4/ipvs/ip_vs_sync.c
===================================================================
--- linux-2.6.15-rc1.orig/net/ipv4/ipvs/ip_vs_sync.c
+++ linux-2.6.15-rc1/net/ipv4/ipvs/ip_vs_sync.c
@@ -786,7 +786,7 @@ static int sync_thread(void *startup)
add_wait_queue(&sync_wait, &wait);
- set_sync_pid(state, current->pid);
+ set_sync_pid(state, task_pid(current));
complete((struct completion *)startup);
/* processing master/backup loop here */
@@ -841,7 +841,7 @@ int start_sync_thread(int state, char *m
(state == IP_VS_STATE_BACKUP && sync_backup_pid))
return -EEXIST;
- IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
+ IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, task_pid(current));
IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %Zd bytes\n",
sizeof(struct ip_vs_sync_conn));
@@ -876,7 +876,7 @@ int stop_sync_thread(int state)
(state == IP_VS_STATE_BACKUP && !sync_backup_pid))
return -ESRCH;
- IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
+ IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, task_pid(current));
IP_VS_INFO("stopping sync thread %d ...\n",
(state == IP_VS_STATE_MASTER) ? sync_master_pid : sync_backup_pid);
Index: linux-2.6.15-rc1/net/ipv4/tcp.c
===================================================================
--- linux-2.6.15-rc1.orig/net/ipv4/tcp.c
+++ linux-2.6.15-rc1/net/ipv4/tcp.c
@@ -1299,7 +1299,7 @@ do_prequeue:
if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) {
if (net_ratelimit())
printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
peek_seq = tp->copied_seq;
}
continue;
Index: linux-2.6.15-rc1/net/ipv6/addrconf.c
===================================================================
--- linux-2.6.15-rc1.orig/net/ipv6/addrconf.c
+++ linux-2.6.15-rc1/net/ipv6/addrconf.c
@@ -2997,7 +2997,7 @@ static void inet6_ifa_notify(int event,
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_IFADDR, ENOBUFS);
return;
}
- if (inet6_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
+ if (inet6_fill_ifaddr(skb, ifa, task_pid(current), 0, event, 0) < 0) {
kfree_skb(skb);
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_IFADDR, EINVAL);
return;
@@ -3132,7 +3132,7 @@ void inet6_ifinfo_notify(int event, stru
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_IFINFO, ENOBUFS);
return;
}
- if (inet6_fill_ifinfo(skb, idev, current->pid, 0, event, 0) < 0) {
+ if (inet6_fill_ifinfo(skb, idev, task_pid(current), 0, event, 0) < 0) {
kfree_skb(skb);
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_IFINFO, EINVAL);
return;
@@ -3192,7 +3192,7 @@ static void inet6_prefix_notify(int even
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_PREFIX, ENOBUFS);
return;
}
- if (inet6_fill_prefix(skb, idev, pinfo, current->pid, 0, event, 0) < 0) {
+ if (inet6_fill_prefix(skb, idev, pinfo, task_pid(current), 0, event, 0) < 0) {
kfree_skb(skb);
netlink_set_err(rtnl, 0, RTNLGRP_IPV6_PREFIX, EINVAL);
return;
Index: linux-2.6.15-rc1/net/ipv6/ip6_flowlabel.c
===================================================================
--- linux-2.6.15-rc1.orig/net/ipv6/ip6_flowlabel.c
+++ linux-2.6.15-rc1/net/ipv6/ip6_flowlabel.c
@@ -342,7 +342,7 @@ fl_create(struct in6_flowlabel_req *freq
case IPV6_FL_S_ANY:
break;
case IPV6_FL_S_PROCESS:
- fl->owner = current->pid;
+ fl->owner = task_pid(current);
break;
case IPV6_FL_S_USER:
fl->owner = current->euid;
Index: linux-2.6.15-rc1/net/ipv6/route.c
===================================================================
--- linux-2.6.15-rc1.orig/net/ipv6/route.c
+++ linux-2.6.15-rc1/net/ipv6/route.c
@@ -1840,7 +1840,7 @@ void inet6_rt_notify(int event, struct r
{
struct sk_buff *skb;
int size = NLMSG_SPACE(sizeof(struct rtmsg)+256);
- u32 pid = current->pid;
+ u32 pid = task_pid(current);
u32 seq = 0;
if (req)
Index: linux-2.6.15-rc1/net/netlink/af_netlink.c
===================================================================
--- linux-2.6.15-rc1.orig/net/netlink/af_netlink.c
+++ linux-2.6.15-rc1/net/netlink/af_netlink.c
@@ -476,7 +476,7 @@ static int netlink_autobind(struct socke
struct hlist_head *head;
struct sock *osk;
struct hlist_node *node;
- s32 pid = current->pid;
+ s32 pid = task_pid(current);
int err;
static s32 rover = -4097;
Index: linux-2.6.15-rc1/net/rxrpc/krxiod.c
===================================================================
--- linux-2.6.15-rc1.orig/net/rxrpc/krxiod.c
+++ linux-2.6.15-rc1/net/rxrpc/krxiod.c
@@ -40,7 +40,7 @@ static int rxrpc_krxiod(void *arg)
{
DECLARE_WAITQUEUE(krxiod,current);
- printk("Started krxiod %d\n",current->pid);
+ printk("Started krxiod %d\n",task_pid(current));
daemonize("krxiod");
Index: linux-2.6.15-rc1/net/rxrpc/krxsecd.c
===================================================================
--- linux-2.6.15-rc1.orig/net/rxrpc/krxsecd.c
+++ linux-2.6.15-rc1/net/rxrpc/krxsecd.c
@@ -53,7 +53,7 @@ static int rxrpc_krxsecd(void *arg)
int die;
- printk("Started krxsecd %d\n", current->pid);
+ printk("Started krxsecd %d\n", task_pid(current));
daemonize("krxsecd");
Index: linux-2.6.15-rc1/net/rxrpc/krxtimod.c
===================================================================
--- linux-2.6.15-rc1.orig/net/rxrpc/krxtimod.c
+++ linux-2.6.15-rc1/net/rxrpc/krxtimod.c
@@ -68,7 +68,7 @@ static int krxtimod(void *arg)
rxrpc_timer_t *timer;
- printk("Started krxtimod %d\n", current->pid);
+ printk("Started krxtimod %d\n", task_pid(current));
daemonize("krxtimod");
Index: linux-2.6.15-rc1/net/sunrpc/sched.c
===================================================================
--- linux-2.6.15-rc1.orig/net/sunrpc/sched.c
+++ linux-2.6.15-rc1/net/sunrpc/sched.c
@@ -792,7 +792,7 @@ void rpc_init_task(struct rpc_task *task
spin_unlock(&rpc_sched_lock);
dprintk("RPC: %4d new task procpid %d\n", task->tk_pid,
- current->pid);
+ task_pid(current));
}
static struct rpc_task *
Index: linux-2.6.15-rc1/net/unix/af_unix.c
===================================================================
--- linux-2.6.15-rc1.orig/net/unix/af_unix.c
+++ linux-2.6.15-rc1/net/unix/af_unix.c
@@ -439,7 +439,7 @@ static int unix_listen(struct socket *so
sk->sk_max_ack_backlog = backlog;
sk->sk_state = TCP_LISTEN;
/* set credentials so connect can copy them */
- sk->sk_peercred.pid = current->tgid;
+ sk->sk_peercred.pid = task_tgid(current);
sk->sk_peercred.uid = current->euid;
sk->sk_peercred.gid = current->egid;
err = 0;
@@ -1043,7 +1043,7 @@ restart:
unix_peer(newsk) = sk;
newsk->sk_state = TCP_ESTABLISHED;
newsk->sk_type = sk->sk_type;
- newsk->sk_peercred.pid = current->tgid;
+ newsk->sk_peercred.pid = task_tgid(current);
newsk->sk_peercred.uid = current->euid;
newsk->sk_peercred.gid = current->egid;
newu = unix_sk(newsk);
@@ -1105,7 +1105,7 @@ static int unix_socketpair(struct socket
sock_hold(skb);
unix_peer(ska)=skb;
unix_peer(skb)=ska;
- ska->sk_peercred.pid = skb->sk_peercred.pid = current->tgid;
+ ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid(current);
ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid;
ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid;
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 10/13] Change pid accesses: security/
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (8 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 09/13] Change pid accesses: net/ Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 11/13] Change pid accesses: sound/ Serge E. Hallyn
` (6 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: B9-change-pid-tgid-references-security --]
[-- Type: text/plain, Size: 5372 bytes --]
Replace-Subject: Change pid accesses: security/
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for security modules.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
security/commoncap.c | 2 +-
security/keys/process_keys.c | 6 +++---
security/keys/request_key_auth.c | 2 +-
security/seclvl.c | 16 ++++++++--------
security/selinux/avc.c | 4 ++--
5 files changed, 15 insertions(+), 15 deletions(-)
Index: linux-2.6.15-rc1/security/commoncap.c
===================================================================
--- linux-2.6.15-rc1.orig/security/commoncap.c
+++ linux-2.6.15-rc1/security/commoncap.c
@@ -169,7 +169,7 @@ void cap_bprm_apply_creds (struct linux_
/* For init, we want to retain the capabilities set
* in the init_task struct. Thus we skip the usual
* capability rules */
- if (current->pid != 1) {
+ if (task_pid(current) != 1) {
current->cap_permitted = new_permitted;
current->cap_effective =
cap_intersect (new_permitted, bprm->cap_effective);
Index: linux-2.6.15-rc1/security/keys/process_keys.c
===================================================================
--- linux-2.6.15-rc1.orig/security/keys/process_keys.c
+++ linux-2.6.15-rc1/security/keys/process_keys.c
@@ -140,7 +140,7 @@ int install_thread_keyring(struct task_s
char buf[20];
int ret;
- sprintf(buf, "_tid.%u", tsk->pid);
+ sprintf(buf, "_tid.%u", task_pid(tsk));
keyring = keyring_alloc(buf, tsk->uid, tsk->gid, 1, NULL);
if (IS_ERR(keyring)) {
@@ -173,7 +173,7 @@ int install_process_keyring(struct task_
int ret;
if (!tsk->signal->process_keyring) {
- sprintf(buf, "_pid.%u", tsk->tgid);
+ sprintf(buf, "_pid.%u", task_tgid(tsk));
keyring = keyring_alloc(buf, tsk->uid, tsk->gid, 1, NULL);
if (IS_ERR(keyring)) {
@@ -213,7 +213,7 @@ static int install_session_keyring(struc
/* create an empty session keyring */
if (!keyring) {
- sprintf(buf, "_ses.%u", tsk->tgid);
+ sprintf(buf, "_ses.%u", task_tgid(tsk));
keyring = keyring_alloc(buf, tsk->uid, tsk->gid, 1, NULL);
if (IS_ERR(keyring)) {
Index: linux-2.6.15-rc1/security/keys/request_key_auth.c
===================================================================
--- linux-2.6.15-rc1.orig/security/keys/request_key_auth.c
+++ linux-2.6.15-rc1/security/keys/request_key_auth.c
@@ -60,7 +60,7 @@ static int request_key_auth_instantiate(
else {
/* it isn't - use this process as the context */
rka->context = current;
- rka->pid = current->pid;
+ rka->pid = task_pid(current);
}
rka->target_key = key_get((struct key *) data);
Index: linux-2.6.15-rc1/security/seclvl.c
===================================================================
--- linux-2.6.15-rc1.orig/security/seclvl.c
+++ linux-2.6.15-rc1/security/seclvl.c
@@ -296,7 +296,7 @@ static struct file_operations passwd_fil
static int seclvl_ptrace(struct task_struct *parent, struct task_struct *child)
{
if (seclvl >= 0) {
- if (child->pid == 1) {
+ if (task_pid(child) == 1) {
seclvl_printk(1, KERN_WARNING, "Attempt to ptrace "
"the init process dissallowed in "
"secure level %d\n", seclvl);
@@ -313,7 +313,7 @@ static int seclvl_ptrace(struct task_str
static int seclvl_capable(struct task_struct *tsk, int cap)
{
/* init can do anything it wants */
- if (tsk->pid == 1)
+ if (task_pid(tsk) == 1)
return 0;
switch (seclvl) {
@@ -375,10 +375,10 @@ static int seclvl_settime(struct timespe
(tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) {
seclvl_printk(1, KERN_WARNING, "Attempt to decrement "
"time in secure level %d denied: "
- "current->pid = [%d], "
- "current->group_leader->pid = [%d]\n",
- seclvl, current->pid,
- current->group_leader->pid);
+ "current pid = [%d], "
+ "current->group_leader pid = [%d]\n",
+ seclvl, task_pid(current),
+ task_pid(current->group_leader));
return -EPERM;
} /* if attempt to decrement time */
} /* if seclvl > 1 */
@@ -424,7 +424,7 @@ static void seclvl_bd_release(struct ino
static int
seclvl_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
{
- if (current->pid != 1 && S_ISBLK(inode->i_mode) && (mask & MAY_WRITE)) {
+ if (task_pid(current) != 1 && S_ISBLK(inode->i_mode) && (mask & MAY_WRITE)) {
switch (seclvl) {
case 2:
seclvl_printk(1, KERN_WARNING, "Write to block device "
@@ -479,7 +479,7 @@ static void seclvl_file_free_security(st
*/
static int seclvl_umount(struct vfsmount *mnt, int flags)
{
- if (current->pid == 1)
+ if (task_pid(current) == 1)
return 0;
if (seclvl == 2) {
seclvl_printk(1, KERN_WARNING, "Attempt to unmount in secure "
Index: linux-2.6.15-rc1/security/selinux/avc.c
===================================================================
--- linux-2.6.15-rc1.orig/security/selinux/avc.c
+++ linux-2.6.15-rc1/security/selinux/avc.c
@@ -558,8 +558,8 @@ void avc_audit(u32 ssid, u32 tsid,
audit_log_format(ab, " for ");
if (a && a->tsk)
tsk = a->tsk;
- if (tsk && tsk->pid) {
- audit_log_format(ab, " pid=%d comm=", tsk->pid);
+ if (tsk && task_pid(tsk)) {
+ audit_log_format(ab, " pid=%d comm=", task_pid(tsk));
audit_log_untrustedstring(ab, tsk->comm);
}
if (a) {
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 11/13] Change pid accesses: sound/
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (9 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 10/13] Change pid accesses: security/ Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 21:23 ` [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips Serge E. Hallyn
` (5 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: BA-change-pid-tgid-references-sound --]
[-- Type: text/plain, Size: 6958 bytes --]
Replace-Subject: Change pid accesses: sound/
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for sound drivers.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
sound/core/control.c | 4 ++--
sound/core/pcm.c | 2 +-
sound/core/rawmidi.c | 2 +-
sound/core/timer.c | 4 ++--
sound/oss/forte.c | 2 +-
sound/pci/korg1212/korg1212.c | 4 ++--
sound/pci/rme9652/hdsp.c | 4 ++--
sound/pci/rme9652/hdspm.c | 4 ++--
sound/pci/rme9652/rme9652.c | 4 ++--
9 files changed, 15 insertions(+), 15 deletions(-)
Index: linux-2.6.15-rc1/sound/core/control.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/core/control.c
+++ linux-2.6.15-rc1/sound/core/control.c
@@ -78,7 +78,7 @@ static int snd_ctl_open(struct inode *in
init_waitqueue_head(&ctl->change_sleep);
spin_lock_init(&ctl->read_lock);
ctl->card = card;
- ctl->pid = current->pid;
+ ctl->pid = task_pid(current);
file->private_data = ctl;
write_lock_irqsave(&card->ctl_files_rwlock, flags);
list_add_tail(&ctl->list, &card->ctl_files);
@@ -781,7 +781,7 @@ static int snd_ctl_elem_lock(snd_ctl_fil
result = -EBUSY;
else {
vd->owner = file;
- vd->owner_pid = current->pid;
+ vd->owner_pid = task_pid(current);
result = 0;
}
}
Index: linux-2.6.15-rc1/sound/core/pcm.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/core/pcm.c
+++ linux-2.6.15-rc1/sound/core/pcm.c
@@ -754,7 +754,7 @@ int snd_pcm_open_substream(snd_pcm_t *pc
down_read(&card->controls_rwsem);
list_for_each(list, &card->ctl_files) {
kctl = snd_ctl_file(list);
- if (kctl->pid == current->pid) {
+ if (kctl->pid == task_pid(current)) {
prefer_subdevice = kctl->prefer_pcm_subdevice;
break;
}
Index: linux-2.6.15-rc1/sound/core/rawmidi.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/core/rawmidi.c
+++ linux-2.6.15-rc1/sound/core/rawmidi.c
@@ -423,7 +423,7 @@ static int snd_rawmidi_open(struct inode
down_read(&card->controls_rwsem);
list_for_each(list, &card->ctl_files) {
kctl = snd_ctl_file(list);
- if (kctl->pid == current->pid) {
+ if (kctl->pid == task_pid(current)) {
subdevice = kctl->prefer_rawmidi_subdevice;
break;
}
Index: linux-2.6.15-rc1/sound/core/timer.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/core/timer.c
+++ linux-2.6.15-rc1/sound/core/timer.c
@@ -1512,10 +1512,10 @@ static int snd_timer_user_tselect(struct
err = -EFAULT;
goto __err;
}
- sprintf(str, "application %i", current->pid);
+ sprintf(str, "application %i", task_pid(current));
if (tselect.id.dev_class != SNDRV_TIMER_CLASS_SLAVE)
tselect.id.dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION;
- err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid);
+ err = snd_timer_open(&tu->timeri, str, &tselect.id, task_pid(current));
if (err < 0)
goto __err;
Index: linux-2.6.15-rc1/sound/oss/forte.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/oss/forte.c
+++ linux-2.6.15-rc1/sound/oss/forte.c
@@ -1256,7 +1256,7 @@ forte_dsp_open (struct inode *inode, str
file->private_data = forte;
- DPRINTK ("%s: dsp opened by %d\n", __FUNCTION__, current->pid);
+ DPRINTK ("%s: dsp opened by %d\n", __FUNCTION__, task_pid(current));
if (file->f_mode & FMODE_WRITE)
forte_channel_init (forte, &forte->play);
Index: linux-2.6.15-rc1/sound/pci/korg1212/korg1212.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/pci/korg1212/korg1212.c
+++ linux-2.6.15-rc1/sound/pci/korg1212/korg1212.c
@@ -1443,7 +1443,7 @@ static int snd_korg1212_playback_open(sn
spin_lock_irqsave(&korg1212->lock, flags);
korg1212->playback_substream = substream;
- korg1212->playback_pid = current->pid;
+ korg1212->playback_pid = task_pid(current);
korg1212->periodsize = K1212_PERIODS;
korg1212->channels = K1212_CHANNELS;
korg1212->errorcnt = 0;
@@ -1475,7 +1475,7 @@ static int snd_korg1212_capture_open(snd
spin_lock_irqsave(&korg1212->lock, flags);
korg1212->capture_substream = substream;
- korg1212->capture_pid = current->pid;
+ korg1212->capture_pid = task_pid(current);
korg1212->periodsize = K1212_PERIODS;
korg1212->channels = K1212_CHANNELS;
Index: linux-2.6.15-rc1/sound/pci/rme9652/hdsp.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/pci/rme9652/hdsp.c
+++ linux-2.6.15-rc1/sound/pci/rme9652/hdsp.c
@@ -4188,7 +4188,7 @@ static int snd_hdsp_playback_open(snd_pc
runtime->dma_area = hdsp->playback_buffer;
runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
- hdsp->playback_pid = current->pid;
+ hdsp->playback_pid = task_pid(current);
hdsp->playback_substream = substream;
spin_unlock_irq(&hdsp->lock);
@@ -4261,7 +4261,7 @@ static int snd_hdsp_capture_open(snd_pcm
runtime->dma_area = hdsp->capture_buffer;
runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
- hdsp->capture_pid = current->pid;
+ hdsp->capture_pid = task_pid(current);
hdsp->capture_substream = substream;
spin_unlock_irq(&hdsp->lock);
Index: linux-2.6.15-rc1/sound/pci/rme9652/hdspm.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/pci/rme9652/hdspm.c
+++ linux-2.6.15-rc1/sound/pci/rme9652/hdspm.c
@@ -3102,7 +3102,7 @@ static int snd_hdspm_playback_open(snd_p
if (hdspm->capture_substream == NULL)
hdspm_stop_audio(hdspm);
- hdspm->playback_pid = current->pid;
+ hdspm->playback_pid = task_pid(current);
hdspm->playback_substream = substream;
spin_unlock_irq(&hdspm->lock);
@@ -3151,7 +3151,7 @@ static int snd_hdspm_capture_open(snd_pc
if (hdspm->playback_substream == NULL)
hdspm_stop_audio(hdspm);
- hdspm->capture_pid = current->pid;
+ hdspm->capture_pid = task_pid(current);
hdspm->capture_substream = substream;
spin_unlock_irq(&hdspm->lock);
Index: linux-2.6.15-rc1/sound/pci/rme9652/rme9652.c
===================================================================
--- linux-2.6.15-rc1.orig/sound/pci/rme9652/rme9652.c
+++ linux-2.6.15-rc1/sound/pci/rme9652/rme9652.c
@@ -2321,7 +2321,7 @@ static int snd_rme9652_playback_open(snd
rme9652_set_thru(rme9652, -1, 0);
}
- rme9652->playback_pid = current->pid;
+ rme9652->playback_pid = task_pid(current);
rme9652->playback_substream = substream;
spin_unlock_irq(&rme9652->lock);
@@ -2381,7 +2381,7 @@ static int snd_rme9652_capture_open(snd_
rme9652_set_thru(rme9652, -1, 0);
}
- rme9652->capture_pid = current->pid;
+ rme9652->capture_pid = task_pid(current);
rme9652->capture_substream = substream;
spin_unlock_irq(&rme9652->lock);
--
^ permalink raw reply [flat|nested] 86+ messages in thread* [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (10 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 11/13] Change pid accesses: sound/ Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-15 23:08 ` Keith Owens
2005-11-14 21:23 ` [RFC] [PATCH 13/13] Define new task_pid api Serge E. Hallyn
` (4 subsequent siblings)
16 siblings, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: BB-ia64-and-mips --]
[-- Type: text/plain, Size: 65204 bytes --]
Replace-Subject: Change pid accesses: ia64 and mips
From: Serge Hallyn <serue@us.ibm.com>
Change pid accesses for ia64 and mips architectures.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
arch/ia64/ia32/ia32_signal.c | 4
arch/ia64/ia32/sys_ia32.c | 6 -
arch/ia64/kernel/mca.c | 4
arch/ia64/kernel/mca_drv.c | 2
arch/ia64/kernel/perfmon.c | 158 ++++++++++++++++----------------
arch/ia64/kernel/perfmon_default_smpl.c | 16 +--
arch/ia64/kernel/process.c | 2
arch/ia64/kernel/signal.c | 8 -
arch/ia64/kernel/traps.c | 6 -
arch/ia64/kernel/unaligned.c | 2
arch/ia64/mm/fault.c | 2
arch/ia64/sn/kernel/xpc_main.c | 2
arch/mips/kernel/irixelf.c | 8 -
arch/mips/kernel/irixioctl.c | 4
arch/mips/kernel/irixsig.c | 20 ++--
arch/mips/kernel/process.c | 2
arch/mips/kernel/signal.c | 4
arch/mips/kernel/signal32.c | 4
arch/mips/kernel/signal_n32.c | 2
arch/mips/kernel/sysirix.c | 136 +++++++++++++--------------
arch/mips/kernel/time.c | 2
arch/mips/kernel/traps.c | 2
arch/mips/mm/fault.c | 4
23 files changed, 200 insertions(+), 200 deletions(-)
Index: linux-2.6.15-rc1/arch/ia64/ia32/ia32_signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/ia32/ia32_signal.c
+++ linux-2.6.15-rc1/arch/ia64/ia32/ia32_signal.c
@@ -868,7 +868,7 @@ setup_frame_ia32 (int sig, struct k_siga
#if 0
printk("SIG deliver (%s:%d): sig=%d sp=%p pc=%lx ra=%x\n",
- current->comm, current->pid, sig, (void *) frame, regs->cr_iip, frame->pretcode);
+ current->comm, task_pid(current), sig, (void *) frame, regs->cr_iip, frame->pretcode);
#endif
return 1;
@@ -946,7 +946,7 @@ setup_rt_frame_ia32 (int sig, struct k_s
#if 0
printk("SIG deliver (%s:%d): sp=%p pc=%lx ra=%x\n",
- current->comm, current->pid, (void *) frame, regs->cr_iip, frame->pretcode);
+ current->comm, task_pid(current), (void *) frame, regs->cr_iip, frame->pretcode);
#endif
return 1;
Index: linux-2.6.15-rc1/arch/ia64/ia32/sys_ia32.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/ia32/sys_ia32.c
+++ linux-2.6.15-rc1/arch/ia64/ia32/sys_ia32.c
@@ -769,7 +769,7 @@ emulate_mmap (struct file *file, unsigne
if (flags & MAP_SHARED)
printk(KERN_INFO
"%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n",
- current->comm, current->pid, start);
+ current->comm, task_pid(current), start);
ret = mmap_subpage(file, start, min(PAGE_ALIGN(start), end), prot, flags,
off);
if (IS_ERR((void *) ret))
@@ -782,7 +782,7 @@ emulate_mmap (struct file *file, unsigne
if (flags & MAP_SHARED)
printk(KERN_INFO
"%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n",
- current->comm, current->pid, end);
+ current->comm, task_pid(current), end);
ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
(off + len) - offset_in_page(end));
if (IS_ERR((void *) ret))
@@ -812,7 +812,7 @@ emulate_mmap (struct file *file, unsigne
if ((flags & MAP_SHARED) && !is_congruent)
printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
- "(addr=0x%lx,off=0x%llx)\n", current->comm, current->pid, start, off);
+ "(addr=0x%lx,off=0x%llx)\n", current->comm, task_pid(current), start, off);
DBG("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n", pstart, pend,
is_congruent ? "congruent" : "not congruent", poff);
Index: linux-2.6.15-rc1/arch/ia64/kernel/mca.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/mca.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/mca.c
@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt
* (swapper or nested MCA/INIT) then use the start of the previous comm
* field suffixed with its cpu.
*/
- if (previous_current->pid)
+ if (previous_task_pid(current))
snprintf(comm, sizeof(comm), "%s %d",
- current->comm, previous_current->pid);
+ current->comm, previous_task_pid(current));
else {
int l;
if ((p = strchr(previous_current->comm, ' ')))
Index: linux-2.6.15-rc1/arch/ia64/kernel/mca_drv.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/mca_drv.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/mca_drv.c
@@ -124,7 +124,7 @@ void
mca_handler_bh(unsigned long paddr)
{
printk(KERN_DEBUG "OS_MCA: process [pid: %d](%s) encounters MCA.\n",
- current->pid, current->comm);
+ task_pid(current), current->comm);
spin_lock(&mca_bh_lock);
switch (mca_page_isolate(paddr)) {
Index: linux-2.6.15-rc1/arch/ia64/kernel/perfmon.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/perfmon.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/perfmon.c
@@ -154,14 +154,14 @@
*/
#define PROTECT_CTX(c, f) \
do { \
- DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, current->pid)); \
+ DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, task_pid(current))); \
spin_lock_irqsave(&(c)->ctx_lock, f); \
- DPRINT(("spinlocked ctx %p by [%d]\n", c, current->pid)); \
+ DPRINT(("spinlocked ctx %p by [%d]\n", c, task_pid(current))); \
} while(0)
#define UNPROTECT_CTX(c, f) \
do { \
- DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, current->pid)); \
+ DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, task_pid(current))); \
spin_unlock_irqrestore(&(c)->ctx_lock, f); \
} while(0)
@@ -223,12 +223,12 @@
#ifdef PFM_DEBUGGING
#define DPRINT(a) \
do { \
- if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \
+ if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), task_pid(current)); printk a; } \
} while (0)
#define DPRINT_ovfl(a) \
do { \
- if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \
+ if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), task_pid(current)); printk a; } \
} while (0)
#endif
@@ -868,7 +868,7 @@ pfm_mask_monitoring(struct task_struct *
unsigned long mask, val, ovfl_mask;
int i;
- DPRINT_ovfl(("masking monitoring for [%d]\n", task->pid));
+ DPRINT_ovfl(("masking monitoring for [%d]\n", task_pid(task)));
ovfl_mask = pmu_conf->ovfl_val;
/*
@@ -948,12 +948,12 @@ pfm_restore_monitoring(struct task_struc
ovfl_mask = pmu_conf->ovfl_val;
if (task != current) {
- printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task->pid, current->pid);
+ printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task_pid(task), task_pid(current));
return;
}
if (ctx->ctx_state != PFM_CTX_MASKED) {
printk(KERN_ERR "perfmon.%d: task[%d] current[%d] invalid state=%d\n", __LINE__,
- task->pid, current->pid, ctx->ctx_state);
+ task_pid(task), task_pid(current), ctx->ctx_state);
return;
}
psr = pfm_get_psr();
@@ -1007,7 +1007,7 @@ pfm_restore_monitoring(struct task_struc
if ((mask & 0x1) == 0UL) continue;
th->pmcs[i] = ctx->ctx_pmcs[i];
ia64_set_pmc(i, th->pmcs[i]);
- DPRINT(("[%d] pmc[%d]=0x%lx\n", task->pid, i, th->pmcs[i]));
+ DPRINT(("[%d] pmc[%d]=0x%lx\n", task_pid(task), i, th->pmcs[i]));
}
ia64_srlz_d();
@@ -1400,7 +1400,7 @@ pfm_remove_smpl_mapping(struct task_stru
/* sanity checks */
if (task->mm == NULL || size == 0UL || vaddr == NULL) {
- printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task->pid, task->mm);
+ printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task_pid(task), task->mm);
return -EINVAL;
}
@@ -1417,7 +1417,7 @@ pfm_remove_smpl_mapping(struct task_stru
up_write(&task->mm->mmap_sem);
if (r !=0) {
- printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task->pid, vaddr, size);
+ printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid(task), vaddr, size);
}
DPRINT(("do_unmap(%p, %lu)=%d\n", vaddr, size, r));
@@ -1459,7 +1459,7 @@ pfm_free_smpl_buffer(pfm_context_t *ctx)
return 0;
invalid_free:
- printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", task_pid(current));
return -EINVAL;
}
#endif
@@ -1512,13 +1512,13 @@ pfm_read(struct file *filp, char __user
unsigned long flags;
DECLARE_WAITQUEUE(wait, current);
if (PFM_IS_FILE(filp) == 0) {
- printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid(current));
return -EINVAL;
}
ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) {
- printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", task_pid(current));
return -EINVAL;
}
@@ -1572,7 +1572,7 @@ pfm_read(struct file *filp, char __user
PROTECT_CTX(ctx, flags);
}
- DPRINT(("[%d] back to running ret=%ld\n", current->pid, ret));
+ DPRINT(("[%d] back to running ret=%ld\n", task_pid(current), ret));
set_current_state(TASK_RUNNING);
remove_wait_queue(&ctx->ctx_msgq_wait, &wait);
@@ -1581,7 +1581,7 @@ pfm_read(struct file *filp, char __user
ret = -EINVAL;
msg = pfm_get_next_msg(ctx);
if (msg == NULL) {
- printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, current->pid);
+ printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, task_pid(current));
goto abort_locked;
}
@@ -1612,13 +1612,13 @@ pfm_poll(struct file *filp, poll_table *
unsigned int mask = 0;
if (PFM_IS_FILE(filp) == 0) {
- printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid(current));
return 0;
}
ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) {
- printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", task_pid(current));
return 0;
}
@@ -1657,7 +1657,7 @@ pfm_do_fasync(int fd, struct file *filp,
ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue);
DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
- current->pid,
+ task_pid(current),
fd,
on,
ctx->ctx_async_queue, ret));
@@ -1672,13 +1672,13 @@ pfm_fasync(int fd, struct file *filp, in
int ret;
if (PFM_IS_FILE(filp) == 0) {
- printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", task_pid(current));
return -EBADF;
}
ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) {
- printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", task_pid(current));
return -EBADF;
}
/*
@@ -1724,7 +1724,7 @@ pfm_syswide_force_stop(void *info)
if (owner != ctx->ctx_task) {
printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected owner [%d] instead of [%d]\n",
smp_processor_id(),
- owner->pid, ctx->ctx_task->pid);
+ owner->pid, ctx->ctx_task_pid(task));
return;
}
if (GET_PMU_CTX() != ctx) {
@@ -1734,7 +1734,7 @@ pfm_syswide_force_stop(void *info)
return;
}
- DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), ctx->ctx_task->pid));
+ DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), ctx->ctx_task_pid(task)));
/*
* the context is already protected in pfm_close(), we simply
* need to mask interrupts to avoid a PMU interrupt race on
@@ -1786,7 +1786,7 @@ pfm_flush(struct file *filp)
ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) {
- printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", task_pid(current));
return -EBADF;
}
@@ -1934,7 +1934,7 @@ pfm_close(struct inode *inode, struct fi
ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) {
- printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", current->pid);
+ printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", task_pid(current));
return -EBADF;
}
@@ -2031,7 +2031,7 @@ pfm_close(struct inode *inode, struct fi
*/
ctx->ctx_state = PFM_CTX_ZOMBIE;
- DPRINT(("zombie ctx for [%d]\n", task->pid));
+ DPRINT(("zombie ctx for [%d]\n", task_pid(task)));
/*
* cannot free the context on the spot. deferred until
* the task notices the ZOMBIE state
@@ -2435,7 +2435,7 @@ pfm_setup_buffer_fmt(struct task_struct
/* invoke and lock buffer format, if found */
fmt = pfm_find_buffer_fmt(arg->ctx_smpl_buf_id);
if (fmt == NULL) {
- DPRINT(("[%d] cannot find buffer format\n", task->pid));
+ DPRINT(("[%d] cannot find buffer format\n", task_pid(task)));
return -EINVAL;
}
@@ -2446,7 +2446,7 @@ pfm_setup_buffer_fmt(struct task_struct
ret = pfm_buf_fmt_validate(fmt, task, ctx_flags, cpu, fmt_arg);
- DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task->pid, ctx_flags, cpu, fmt_arg, ret));
+ DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task_pid(task), ctx_flags, cpu, fmt_arg, ret));
if (ret) goto error;
@@ -2568,23 +2568,23 @@ pfm_task_incompatible(pfm_context_t *ctx
* no kernel task or task not owner by caller
*/
if (task->mm == NULL) {
- DPRINT(("task [%d] has not memory context (kernel thread)\n", task->pid));
+ DPRINT(("task [%d] has not memory context (kernel thread)\n", task_pid(task)));
return -EPERM;
}
if (pfm_bad_permissions(task)) {
- DPRINT(("no permission to attach to [%d]\n", task->pid));
+ DPRINT(("no permission to attach to [%d]\n", task_pid(task)));
return -EPERM;
}
/*
* cannot block in self-monitoring mode
*/
if (CTX_OVFL_NOBLOCK(ctx) == 0 && task == current) {
- DPRINT(("cannot load a blocking context on self for [%d]\n", task->pid));
+ DPRINT(("cannot load a blocking context on self for [%d]\n", task_pid(task)));
return -EINVAL;
}
if (task->exit_state == EXIT_ZOMBIE) {
- DPRINT(("cannot attach to zombie task [%d]\n", task->pid));
+ DPRINT(("cannot attach to zombie task [%d]\n", task_pid(task)));
return -EBUSY;
}
@@ -2594,7 +2594,7 @@ pfm_task_incompatible(pfm_context_t *ctx
if (task == current) return 0;
if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) {
- DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task->pid, task->state));
+ DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task_pid(task), task->state));
return -EBUSY;
}
/*
@@ -2616,7 +2616,7 @@ pfm_get_task(pfm_context_t *ctx, pid_t p
/* XXX: need to add more checks here */
if (pid < 2) return -EPERM;
- if (pid != current->pid) {
+ if (pid != task_pid(current)) {
read_lock(&tasklist_lock);
@@ -3481,7 +3481,7 @@ pfm_use_debug_registers(struct task_stru
if (pmu_conf->use_rr_dbregs == 0) return 0;
- DPRINT(("called for [%d]\n", task->pid));
+ DPRINT(("called for [%d]\n", task_pid(task)));
/*
* do it only once
@@ -3512,7 +3512,7 @@ pfm_use_debug_registers(struct task_stru
DPRINT(("ptrace_use_dbregs=%u sys_use_dbregs=%u by [%d] ret = %d\n",
pfm_sessions.pfs_ptrace_use_dbregs,
pfm_sessions.pfs_sys_use_dbregs,
- task->pid, ret));
+ task_pid(task), ret));
UNLOCK_PFS(flags);
@@ -3537,7 +3537,7 @@ pfm_release_debug_registers(struct task_
LOCK_PFS(flags);
if (pfm_sessions.pfs_ptrace_use_dbregs == 0) {
- printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task->pid);
+ printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task_pid(task));
ret = -1;
} else {
pfm_sessions.pfs_ptrace_use_dbregs--;
@@ -3589,7 +3589,7 @@ pfm_restart(pfm_context_t *ctx, void *ar
/* sanity check */
if (unlikely(task == NULL)) {
- printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", current->pid);
+ printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", task_pid(current));
return -EINVAL;
}
@@ -3598,7 +3598,7 @@ pfm_restart(pfm_context_t *ctx, void *ar
fmt = ctx->ctx_buf_fmt;
DPRINT(("restarting self %d ovfl=0x%lx\n",
- task->pid,
+ task_pid(task),
ctx->ctx_ovfl_regs[0]));
if (CTX_HAS_SMPL(ctx)) {
@@ -3622,11 +3622,11 @@ pfm_restart(pfm_context_t *ctx, void *ar
pfm_reset_regs(ctx, ctx->ctx_ovfl_regs, PFM_PMD_LONG_RESET);
if (rst_ctrl.bits.mask_monitoring == 0) {
- DPRINT(("resuming monitoring for [%d]\n", task->pid));
+ DPRINT(("resuming monitoring for [%d]\n", task_pid(task)));
if (state == PFM_CTX_MASKED) pfm_restore_monitoring(task);
} else {
- DPRINT(("keeping monitoring stopped for [%d]\n", task->pid));
+ DPRINT(("keeping monitoring stopped for [%d]\n", task_pid(task)));
// cannot use pfm_stop_monitoring(task, regs);
}
@@ -3683,10 +3683,10 @@ pfm_restart(pfm_context_t *ctx, void *ar
* "self-monitoring".
*/
if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
- DPRINT(("unblocking [%d] \n", task->pid));
+ DPRINT(("unblocking [%d] \n", task_pid(task)));
up(&ctx->ctx_restart_sem);
} else {
- DPRINT(("[%d] armed exit trap\n", task->pid));
+ DPRINT(("[%d] armed exit trap\n", task_pid(task)));
ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET;
@@ -3774,7 +3774,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_
* don't bother if we are loaded and task is being debugged
*/
if (is_loaded && (thread->flags & IA64_THREAD_DBG_VALID) != 0) {
- DPRINT(("debug registers already in use for [%d]\n", task->pid));
+ DPRINT(("debug registers already in use for [%d]\n", task_pid(task)));
return -EBUSY;
}
@@ -3815,7 +3815,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_
* is shared by all processes running on it
*/
if (first_time && can_access_pmu) {
- DPRINT(("[%d] clearing ibrs, dbrs\n", task->pid));
+ DPRINT(("[%d] clearing ibrs, dbrs\n", task_pid(task)));
for (i=0; i < pmu_conf->num_ibrs; i++) {
ia64_set_ibr(i, 0UL);
ia64_dv_serialize_instruction();
@@ -4062,7 +4062,7 @@ pfm_stop(pfm_context_t *ctx, void *arg,
* monitoring disabled in kernel at next reschedule
*/
ctx->ctx_saved_psr_up = 0;
- DPRINT(("task=[%d]\n", task->pid));
+ DPRINT(("task=[%d]\n", task_pid(task)));
}
return 0;
}
@@ -4228,7 +4228,7 @@ pfm_context_load(pfm_context_t *ctx, voi
DPRINT(("load_pid [%d] using_dbreg=%d\n", req->load_pid, ctx->ctx_fl_using_dbreg));
- if (CTX_OVFL_NOBLOCK(ctx) == 0 && req->load_pid == current->pid) {
+ if (CTX_OVFL_NOBLOCK(ctx) == 0 && req->load_pid == task_pid(current)) {
DPRINT(("cannot use blocking mode on self\n"));
return -EINVAL;
}
@@ -4267,11 +4267,11 @@ pfm_context_load(pfm_context_t *ctx, voi
if (is_system) {
if (pfm_sessions.pfs_ptrace_use_dbregs) {
- DPRINT(("cannot load [%d] dbregs in use\n", task->pid));
+ DPRINT(("cannot load [%d] dbregs in use\n", task_pid(task)));
ret = -EBUSY;
} else {
pfm_sessions.pfs_sys_use_dbregs++;
- DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task->pid, pfm_sessions.pfs_sys_use_dbregs));
+ DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task_pid(task), pfm_sessions.pfs_sys_use_dbregs));
set_dbregs = 1;
}
}
@@ -4363,7 +4363,7 @@ pfm_context_load(pfm_context_t *ctx, voi
/* allow user level control */
ia64_psr(regs)->sp = 0;
- DPRINT(("clearing psr.sp for [%d]\n", task->pid));
+ DPRINT(("clearing psr.sp for [%d]\n", task_pid(task)));
SET_LAST_CPU(ctx, smp_processor_id());
INC_ACTIVATION();
@@ -4398,7 +4398,7 @@ pfm_context_load(pfm_context_t *ctx, voi
*/
SET_PMU_OWNER(task, ctx);
- DPRINT(("context loaded on PMU for [%d]\n", task->pid));
+ DPRINT(("context loaded on PMU for [%d]\n", task_pid(task)));
} else {
/*
* when not current, task MUST be stopped, so this is safe
@@ -4462,7 +4462,7 @@ pfm_context_unload(pfm_context_t *ctx, v
int prev_state, is_system;
int ret;
- DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task->pid : -1));
+ DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task_pid(task) : -1));
prev_state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
@@ -4537,7 +4537,7 @@ pfm_context_unload(pfm_context_t *ctx, v
*/
ia64_psr(regs)->sp = 1;
- DPRINT(("setting psr.sp for [%d]\n", task->pid));
+ DPRINT(("setting psr.sp for [%d]\n", task_pid(task)));
}
/*
* save PMDs to context
@@ -4577,7 +4577,7 @@ pfm_context_unload(pfm_context_t *ctx, v
ctx->ctx_fl_can_restart = 0;
ctx->ctx_fl_going_zombie = 0;
- DPRINT(("disconnected [%d] from context\n", task->pid));
+ DPRINT(("disconnected [%d] from context\n", task_pid(task)));
return 0;
}
@@ -4600,7 +4600,7 @@ pfm_exit_thread(struct task_struct *task
PROTECT_CTX(ctx, flags);
- DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task->pid));
+ DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task_pid(task)));
state = ctx->ctx_state;
switch(state) {
@@ -4609,13 +4609,13 @@ pfm_exit_thread(struct task_struct *task
* only comes to thios function if pfm_context is not NULL, i.e., cannot
* be in unloaded state
*/
- printk(KERN_ERR "perfmon: pfm_exit_thread [%d] ctx unloaded\n", task->pid);
+ printk(KERN_ERR "perfmon: pfm_exit_thread [%d] ctx unloaded\n", task_pid(task));
break;
case PFM_CTX_LOADED:
case PFM_CTX_MASKED:
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
- printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task->pid, state, ret);
+ printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid(task), state, ret);
}
DPRINT(("ctx unloaded for current state was %d\n", state));
@@ -4624,12 +4624,12 @@ pfm_exit_thread(struct task_struct *task
case PFM_CTX_ZOMBIE:
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
- printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task->pid, state, ret);
+ printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid(task), state, ret);
}
free_ok = 1;
break;
default:
- printk(KERN_ERR "perfmon: pfm_exit_thread [%d] unexpected state=%d\n", task->pid, state);
+ printk(KERN_ERR "perfmon: pfm_exit_thread [%d] unexpected state=%d\n", task_pid(task), state);
break;
}
UNPROTECT_CTX(ctx, flags);
@@ -4713,7 +4713,7 @@ recheck:
DPRINT(("context %d state=%d [%d] task_state=%ld must_stop=%d\n",
ctx->ctx_fd,
state,
- task->pid,
+ task_pid(task),
task->state, PFM_CMD_STOPPED(cmd)));
/*
@@ -4760,7 +4760,7 @@ recheck:
*/
if (PFM_CMD_STOPPED(cmd)) {
if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) {
- DPRINT(("[%d] task not in stopped state\n", task->pid));
+ DPRINT(("[%d] task not in stopped state\n", task_pid(task)));
return -EBUSY;
}
/*
@@ -4853,7 +4853,7 @@ restart_args:
* limit abuse to min page size
*/
if (unlikely(sz > PFM_MAX_ARGSIZE)) {
- printk(KERN_ERR "perfmon: [%d] argument too big %lu\n", current->pid, sz);
+ printk(KERN_ERR "perfmon: [%d] argument too big %lu\n", task_pid(current), sz);
return -E2BIG;
}
@@ -4998,11 +4998,11 @@ pfm_context_force_terminate(pfm_context_
{
int ret;
- DPRINT(("entering for [%d]\n", current->pid));
+ DPRINT(("entering for [%d]\n", task_pid(current)));
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
- printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", current->pid, ret);
+ printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", task_pid(current), ret);
}
/*
@@ -5039,7 +5039,7 @@ pfm_handle_work(void)
ctx = PFM_GET_CTX(current);
if (ctx == NULL) {
- printk(KERN_ERR "perfmon: [%d] has no PFM context\n", current->pid);
+ printk(KERN_ERR "perfmon: [%d] has no PFM context\n", task_pid(current));
return;
}
@@ -5236,7 +5236,7 @@ pfm_overflow_handler(struct task_struct
DPRINT_ovfl(("pmc0=0x%lx pid=%d iip=0x%lx, %s "
"used_pmds=0x%lx\n",
pmc0,
- task ? task->pid: -1,
+ task ? task_pid(task): -1,
(regs ? regs->cr_iip : 0),
CTX_OVFL_NOBLOCK(ctx) ? "nonblocking" : "blocking",
ctx->ctx_used_pmds[0]));
@@ -5450,7 +5450,7 @@ pfm_overflow_handler(struct task_struct
sanity_check:
printk(KERN_ERR "perfmon: CPU%d overflow handler [%d] pmc0=0x%lx\n",
smp_processor_id(),
- task ? task->pid : -1,
+ task ? task_pid(task) : -1,
pmc0);
return;
@@ -5483,7 +5483,7 @@ stop_monitoring:
*
* Overall pretty hairy stuff....
*/
- DPRINT(("ctx is zombie for [%d], converted to spurious\n", task ? task->pid: -1));
+ DPRINT(("ctx is zombie for [%d], converted to spurious\n", task ? task_pid(task): -1));
pfm_clear_psr_up();
ia64_psr(regs)->up = 0;
ia64_psr(regs)->sp = 1;
@@ -5544,13 +5544,13 @@ pfm_do_interrupt_handler(int irq, void *
report_spurious1:
printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d has no PFM context\n",
- this_cpu, task->pid);
+ this_cpu, task_pid(task));
pfm_unfreeze_pmu();
return -1;
report_spurious2:
printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d, invalid flag\n",
this_cpu,
- task->pid);
+ task_pid(task));
pfm_unfreeze_pmu();
return -1;
}
@@ -5792,7 +5792,7 @@ pfm_syst_wide_update_task(struct task_st
* pid 0 is guaranteed to be the idle task. There is one such task with pid 0
* on every CPU, so we can rely on the pid to identify the idle task.
*/
- if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task->pid) {
+ if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task_pid(task)) {
regs = ia64_task_regs(task);
ia64_psr(regs)->pp = is_ctxswin ? dcr_pp : 0;
return;
@@ -5836,7 +5836,7 @@ pfm_force_cleanup(pfm_context_t *ctx, st
ia64_psr(regs)->sp = 1;
if (GET_PMU_OWNER() == task) {
- DPRINT(("cleared ownership for [%d]\n", ctx->ctx_task->pid));
+ DPRINT(("cleared ownership for [%d]\n", ctx->ctx_task_pid(task)));
SET_PMU_OWNER(NULL, NULL);
}
@@ -5848,7 +5848,7 @@ pfm_force_cleanup(pfm_context_t *ctx, st
task->thread.pfm_context = NULL;
task->thread.flags &= ~IA64_THREAD_PM_VALID;
- DPRINT(("force cleanup for [%d]\n", task->pid));
+ DPRINT(("force cleanup for [%d]\n", task_pid(task)));
}
@@ -6400,7 +6400,7 @@ pfm_flush_pmds(struct task_struct *task,
if (PMD_IS_COUNTING(i)) {
DPRINT(("[%d] pmd[%d] ctx_pmd=0x%lx hw_pmd=0x%lx\n",
- task->pid,
+ task_pid(task),
i,
ctx->ctx_pmds[i].val,
val & ovfl_val));
@@ -6422,11 +6422,11 @@ pfm_flush_pmds(struct task_struct *task,
*/
if (pmc0 & (1UL << i)) {
val += 1 + ovfl_val;
- DPRINT(("[%d] pmd[%d] overflowed\n", task->pid, i));
+ DPRINT(("[%d] pmd[%d] overflowed\n", task_pid(task), i));
}
}
- DPRINT(("[%d] ctx_pmd[%d]=0x%lx pmd_val=0x%lx\n", task->pid, i, val, pmd_val));
+ DPRINT(("[%d] ctx_pmd[%d]=0x%lx pmd_val=0x%lx\n", task_pid(task), i, val, pmd_val));
if (is_self) task->thread.pmds[i] = pmd_val;
@@ -6765,14 +6765,14 @@ dump_pmu_state(const char *from)
printk("CPU%d from %s() current [%d] iip=0x%lx %s\n",
this_cpu,
from,
- current->pid,
+ task_pid(current),
regs->cr_iip,
current->comm);
task = GET_PMU_OWNER();
ctx = GET_PMU_CTX();
- printk("->CPU%d owner [%d] ctx=%p\n", this_cpu, task ? task->pid : -1, ctx);
+ printk("->CPU%d owner [%d] ctx=%p\n", this_cpu, task ? task_pid(task) : -1, ctx);
psr = pfm_get_psr();
@@ -6822,7 +6822,7 @@ pfm_inherit(struct task_struct *task, st
{
struct thread_struct *thread;
- DPRINT(("perfmon: pfm_inherit clearing state for [%d]\n", task->pid));
+ DPRINT(("perfmon: pfm_inherit clearing state for [%d]\n", task_pid(task)));
thread = &task->thread;
Index: linux-2.6.15-rc1/arch/ia64/kernel/perfmon_default_smpl.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/perfmon_default_smpl.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/perfmon_default_smpl.c
@@ -45,11 +45,11 @@ default_validate(struct task_struct *tas
int ret = 0;
if (data == NULL) {
- DPRINT(("[%d] no argument passed\n", task->pid));
+ DPRINT(("[%d] no argument passed\n", task_pid(task)));
return -EINVAL;
}
- DPRINT(("[%d] validate flags=0x%x CPU%d\n", task->pid, flags, cpu));
+ DPRINT(("[%d] validate flags=0x%x CPU%d\n", task_pid(task), flags, cpu));
/*
* must hold at least the buffer header + one minimally sized entry
@@ -89,7 +89,7 @@ default_init(struct task_struct *task, v
hdr->hdr_count = 0UL;
DPRINT(("[%d] buffer=%p buf_size=%lu hdr_size=%lu hdr_version=%u cur_offs=%lu\n",
- task->pid,
+ task_pid(task),
buf,
hdr->hdr_buf_size,
sizeof(*hdr),
@@ -111,7 +111,7 @@ default_handler(struct task_struct *task
unsigned char ovfl_notify;
if (unlikely(buf == NULL || arg == NULL|| regs == NULL || task == NULL)) {
- DPRINT(("[%d] invalid arguments buf=%p arg=%p\n", task->pid, buf, arg));
+ DPRINT(("[%d] invalid arguments buf=%p arg=%p\n", task_pid(task), buf, arg));
return -EINVAL;
}
@@ -140,7 +140,7 @@ default_handler(struct task_struct *task
hdr->hdr_count++;
DPRINT_ovfl(("[%d] count=%lu cur=%p last=%p free_bytes=%lu ovfl_pmd=%d ovfl_notify=%d npmds=%u\n",
- task->pid,
+ task_pid(task),
hdr->hdr_count,
cur, last,
last-cur,
@@ -157,7 +157,7 @@ default_handler(struct task_struct *task
* system-wide:
* - this is not necessarily the task controlling the session
*/
- ent->pid = current->pid;
+ ent->pid = task_pid(current);
ent->ovfl_pmd = ovfl_pmd;
ent->last_reset_val = arg->pmd_last_reset; //pmd[0].reg_last_reset_val;
@@ -169,7 +169,7 @@ default_handler(struct task_struct *task
ent->tstamp = stamp;
ent->cpu = smp_processor_id();
ent->set = arg->active_set;
- ent->tgid = current->tgid;
+ ent->tgid = task_tgid(current);
/*
* selectively store PMDs in increasing index number
@@ -246,7 +246,7 @@ default_restart(struct task_struct *task
static int
default_exit(struct task_struct *task, void *buf, struct pt_regs *regs)
{
- DPRINT(("[%d] exit(%p)\n", task->pid, buf));
+ DPRINT(("[%d] exit(%p)\n", task_pid(task), buf));
return 0;
}
Index: linux-2.6.15-rc1/arch/ia64/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/process.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/process.c
@@ -109,7 +109,7 @@ show_regs (struct pt_regs *regs)
unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
print_modules();
- printk("\nPid: %d, CPU %d, comm: %20s\n", current->pid, smp_processor_id(), current->comm);
+ printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid(current), smp_processor_id(), current->comm);
printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n",
regs->cr_ipsr, regs->cr_ifs, ip, print_tainted());
print_symbol("ip is at %s\n", ip);
Index: linux-2.6.15-rc1/arch/ia64/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/signal.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/signal.c
@@ -257,7 +257,7 @@ ia64_rt_sigreturn (struct sigscratch *sc
#if DEBUG_SIG
printk("SIG return (%s:%d): sp=%lx ip=%lx\n",
- current->comm, current->pid, scr->pt.r12, scr->pt.cr_iip);
+ current->comm, task_pid(current), scr->pt.r12, scr->pt.cr_iip);
#endif
/*
* It is more difficult to avoid calling this function than to
@@ -270,7 +270,7 @@ ia64_rt_sigreturn (struct sigscratch *sc
si.si_signo = SIGSEGV;
si.si_errno = 0;
si.si_code = SI_KERNEL;
- si.si_pid = current->pid;
+ si.si_pid = task_pid(current);
si.si_uid = current->uid;
si.si_addr = sc;
force_sig_info(SIGSEGV, &si, current);
@@ -375,7 +375,7 @@ force_sigsegv_info (int sig, void __user
si.si_signo = SIGSEGV;
si.si_errno = 0;
si.si_code = SI_KERNEL;
- si.si_pid = current->pid;
+ si.si_pid = task_pid(current);
si.si_uid = current->uid;
si.si_addr = addr;
force_sig_info(SIGSEGV, &si, current);
@@ -448,7 +448,7 @@ setup_frame (int sig, struct k_sigaction
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sig=%d sp=%lx ip=%lx handler=%p\n",
- current->comm, current->pid, sig, scr->pt.r12, frame->sc.sc_ip, frame->handler);
+ current->comm, task_pid(current), sig, scr->pt.r12, frame->sc.sc_ip, frame->handler);
#endif
return 1;
}
Index: linux-2.6.15-rc1/arch/ia64/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/traps.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/traps.c
@@ -107,7 +107,7 @@ die (const char *str, struct pt_regs *re
if (++die.lock_owner_depth < 3) {
printk("%s[%d]: %s %ld [%d]\n",
- current->comm, current->pid, str, err, ++die_counter);
+ current->comm, task_pid(current), str, err, ++die_counter);
(void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
show_regs(regs);
} else
@@ -346,7 +346,7 @@ handle_fpu_swa (int fp_fault, struct pt_
++fpu_swa_count;
printk(KERN_WARNING
"%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
- current->comm, current->pid, regs->cr_iip + ia64_psr(regs)->ri, isr);
+ current->comm, task_pid(current), regs->cr_iip + ia64_psr(regs)->ri, isr);
}
exception = fp_emulate(fp_fault, bundle, ®s->cr_ipsr, ®s->ar_fpsr, &isr, ®s->pr,
@@ -482,7 +482,7 @@ ia64_fault (unsigned long vector, unsign
if (code == 8) {
# ifdef CONFIG_IA64_PRINT_HAZARDS
printk("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
regs.cr_iip + ia64_psr(®s)->ri, regs.pr);
# endif
return;
Index: linux-2.6.15-rc1/arch/ia64/kernel/unaligned.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/kernel/unaligned.c
+++ linux-2.6.15-rc1/arch/ia64/kernel/unaligned.c
@@ -1330,7 +1330,7 @@ ia64_handle_unaligned (unsigned long ifa
size_t len;
len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, "
- "ip=0x%016lx\n\r", current->comm, current->pid,
+ "ip=0x%016lx\n\r", current->comm, task_pid(current),
ifa, regs->cr_iip + ipsr->ri);
/*
* Don't call tty_write_message() if we're in the kernel; we might
Index: linux-2.6.15-rc1/arch/ia64/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/mm/fault.c
+++ linux-2.6.15-rc1/arch/ia64/mm/fault.c
@@ -241,7 +241,7 @@ ia64_do_page_fault (unsigned long addres
out_of_memory:
up_read(&mm->mmap_sem);
- if (current->pid == 1) {
+ if (task_pid(current) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
Index: linux-2.6.15-rc1/arch/ia64/sn/kernel/xpc_main.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/ia64/sn/kernel/xpc_main.c
+++ linux-2.6.15-rc1/arch/ia64/sn/kernel/xpc_main.c
@@ -508,7 +508,7 @@ xpc_activating(void *__partid)
ret = sched_setscheduler(current, SCHED_FIFO, ¶m);
if (ret != 0) {
dev_warn(xpc_part, "unable to set pid %d to a realtime "
- "priority, ret=%d\n", current->pid, ret);
+ "priority, ret=%d\n", task_pid(current), ret);
}
/* allow this thread and its children to run on any CPU */
Index: linux-2.6.15-rc1/arch/mips/kernel/irixelf.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/irixelf.c
+++ linux-2.6.15-rc1/arch/mips/kernel/irixelf.c
@@ -556,9 +556,9 @@ static void irix_map_prda_page(void)
return;
pp = (struct prda *) v;
- pp->prda_sys.t_pid = current->pid;
+ pp->prda_sys.t_pid = task_pid(current);
pp->prda_sys.t_prid = read_c0_prid();
- pp->prda_sys.t_rpid = current->pid;
+ pp->prda_sys.t_rpid = task_pid(current);
/* We leave the rest set to zero */
}
@@ -1148,11 +1148,11 @@ static int irix_core_dump(long signr, st
prstatus.pr_info.si_signo = prstatus.pr_cursig = signr;
prstatus.pr_sigpend = current->pending.signal.sig[0];
prstatus.pr_sighold = current->blocked.sig[0];
- psinfo.pr_pid = prstatus.pr_pid = current->pid;
+ psinfo.pr_pid = prstatus.pr_pid = task_pid(current);
psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid;
psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current);
psinfo.pr_sid = prstatus.pr_sid = current->signal->session;
- if (current->pid == current->tgid) {
+ if (task_pid(current) == task_tgid(current)) {
/*
* This is the record for the group leader. Add in the
* cumulative times of previous dead threads. This total
Index: linux-2.6.15-rc1/arch/mips/kernel/irixioctl.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/irixioctl.c
+++ linux-2.6.15-rc1/arch/mips/kernel/irixioctl.c
@@ -62,7 +62,7 @@ asmlinkage int irix_ioctl(int fd, unsign
int i, error = 0;
#ifdef DEBUG_IOCTLS
- printk("[%s:%d] irix_ioctl(%d, ", current->comm, current->pid, fd);
+ printk("[%s:%d] irix_ioctl(%d, ", current->comm, task_pid(current), fd);
#endif
switch(cmd) {
case 0x00005401:
@@ -236,7 +236,7 @@ asmlinkage int irix_ioctl(int fd, unsign
sys_write(2, msg, strlen(msg));
set_fs(old_fs);
printk("[%s:%d] Does unimplemented IRIX ioctl cmd %08lx\n",
- current->comm, current->pid, cmd);
+ current->comm, task_pid(current), cmd);
do_exit(255);
#else
error = sys_ioctl (fd, cmd, arg);
Index: linux-2.6.15-rc1/arch/mips/kernel/irixsig.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/irixsig.c
+++ linux-2.6.15-rc1/arch/mips/kernel/irixsig.c
@@ -232,7 +232,7 @@ irix_sigreturn(struct pt_regs *regs)
sig = (int) regs->regs[base + 6];
#ifdef DEBUG_SIG
printk("[%s:%d] IRIX sigreturn(scp[%p],ucp[%p],sig[%d])\n",
- current->comm, current->pid, context, magic, sig);
+ current->comm, task_pid(current), context, magic, sig);
#endif
if (!context)
context = magic;
@@ -473,7 +473,7 @@ asmlinkage int irix_sigpoll_sys(unsigned
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigpoll_sys(%p,%p,%p)\n",
- current->comm, current->pid, set, info, tp);
+ current->comm, task_pid(current), set, info, tp);
#endif
/* Must always specify the signal set. */
@@ -586,7 +586,7 @@ repeat:
tsk = current;
list_for_each(_p,&tsk->children) {
p = list_entry(_p,struct task_struct,sibling);
- if ((type == IRIX_P_PID) && p->pid != pid)
+ if ((type == IRIX_P_PID) && task_pid(p) != pid)
continue;
if ((type == IRIX_P_PGID) && process_group(p) != pid)
continue;
@@ -613,7 +613,7 @@ repeat:
retval = __put_user(SIGCHLD, &info->sig);
retval |= __put_user(0, &info->code);
- retval |= __put_user(p->pid, &info->stuff.procinfo.pid);
+ retval |= __put_user(task_pid(p), &info->stuff.procinfo.pid);
retval |= __put_user((p->exit_code >> 8) & 0xff,
&info->stuff.procinfo.procdata.child.status);
retval |= __put_user(p->utime, &info->stuff.procinfo.procdata.child.utime);
@@ -631,7 +631,7 @@ repeat:
getrusage(p, RUSAGE_BOTH, ru);
retval = __put_user(SIGCHLD, &info->sig);
retval |= __put_user(1, &info->code); /* CLD_EXITED */
- retval |= __put_user(p->pid, &info->stuff.procinfo.pid);
+ retval |= __put_user(task_pid(p), &info->stuff.procinfo.pid);
retval |= __put_user((p->exit_code >> 8) & 0xff,
&info->stuff.procinfo.procdata.child.status);
retval |= __put_user(p->utime,
@@ -701,7 +701,7 @@ asmlinkage int irix_getcontext(struct pt
#ifdef DEBUG_SIG
printk("[%s:%d] irix_getcontext(%p)\n",
- current->comm, current->pid, ctx);
+ current->comm, task_pid(current), ctx);
#endif
if (!access_ok(VERIFY_WRITE, ctx, sizeof(*ctx)));
@@ -749,7 +749,7 @@ asmlinkage void irix_setcontext(struct p
#ifdef DEBUG_SIG
printk("[%s:%d] irix_setcontext(%p)\n",
- current->comm, current->pid, ctx);
+ current->comm, task_pid(current), ctx);
#endif
if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx)))
@@ -806,7 +806,7 @@ asmlinkage int irix_sigstack(struct irix
{
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigstack(%p,%p)\n",
- current->comm, current->pid, new, old);
+ current->comm, task_pid(current), new, old);
#endif
if (new) {
if (!access_ok(VERIFY_READ, new, sizeof(*new)))
@@ -828,7 +828,7 @@ asmlinkage int irix_sigaltstack(struct i
{
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigaltstack(%p,%p)\n",
- current->comm, current->pid, new, old);
+ current->comm, task_pid(current), new, old);
#endif
if (new)
if (!access_ok(VERIFY_READ, new, sizeof(*new)))
@@ -852,7 +852,7 @@ asmlinkage int irix_sigsendset(struct ir
return -EFAULT;
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigsendset([%d,%d,%d,%d,%d],%d)\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
pset->cmd, pset->ltype, pset->lid, pset->rtype, pset->rid,
sig);
#endif
Index: linux-2.6.15-rc1/arch/mips/kernel/process.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/process.c
+++ linux-2.6.15-rc1/arch/mips/kernel/process.c
@@ -170,7 +170,7 @@ int copy_thread(int nr, unsigned long cl
}
#endif
childregs->regs[2] = 0; /* Child gets zero as return value */
- regs->regs[2] = p->pid;
+ regs->regs[2] = task_pid(p);
if (childregs->cp0_status & ST0_CU0) {
childregs->regs[28] = (unsigned long) ti;
Index: linux-2.6.15-rc1/arch/mips/kernel/signal.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/signal.c
+++ linux-2.6.15-rc1/arch/mips/kernel/signal.c
@@ -314,7 +314,7 @@ int setup_frame(struct k_sigaction * ka,
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
frame, regs->cp0_epc, frame->regs[31]);
#endif
return 1;
@@ -374,7 +374,7 @@ int setup_rt_frame(struct k_sigaction *
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
frame, regs->cp0_epc, regs->regs[31]);
#endif
return 1;
Index: linux-2.6.15-rc1/arch/mips/kernel/signal32.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/signal32.c
+++ linux-2.6.15-rc1/arch/mips/kernel/signal32.c
@@ -691,7 +691,7 @@ int setup_frame_32(struct k_sigaction *
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
frame, regs->cp0_epc, frame->sf_code);
#endif
return 1;
@@ -762,7 +762,7 @@ int setup_rt_frame_32(struct k_sigaction
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
frame, regs->cp0_epc, frame->rs_code);
#endif
return 1;
Index: linux-2.6.15-rc1/arch/mips/kernel/signal_n32.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/signal_n32.c
+++ linux-2.6.15-rc1/arch/mips/kernel/signal_n32.c
@@ -181,7 +181,7 @@ int setup_rt_frame_n32(struct k_sigactio
#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
frame, regs->cp0_epc, regs->regs[31]);
#endif
return 1;
Index: linux-2.6.15-rc1/arch/mips/kernel/sysirix.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/sysirix.c
+++ linux-2.6.15-rc1/arch/mips/kernel/sysirix.c
@@ -64,7 +64,7 @@ asmlinkage int irix_sysmp(struct pt_regs
break;
default:
printk("SYSMP[%s:%d]: Unsupported opcode %d\n",
- current->comm, current->pid, (int)cmd);
+ current->comm, task_pid(current), (int)cmd);
error = -EINVAL;
break;
}
@@ -99,7 +99,7 @@ asmlinkage int irix_prctl(unsigned optio
switch (option) {
case PR_MAXPROCS:
printk("irix_prctl[%s:%d]: Wants PR_MAXPROCS\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = max_threads;
break;
@@ -107,7 +107,7 @@ asmlinkage int irix_prctl(unsigned optio
struct task_struct *task;
printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
read_lock(&tasklist_lock);
task = find_task_by_pid(va_arg(args, pid_t));
error = -ESRCH;
@@ -122,7 +122,7 @@ asmlinkage int irix_prctl(unsigned optio
long value = va_arg(args, long);
printk("irix_prctl[%s:%d]: Wants PR_SETSTACKSIZE<%08lx>\n",
- current->comm, current->pid, (unsigned long) value);
+ current->comm, task_pid(current), (unsigned long) value);
if (value > RLIM_INFINITY)
value = RLIM_INFINITY;
if (capable(CAP_SYS_ADMIN)) {
@@ -147,25 +147,25 @@ asmlinkage int irix_prctl(unsigned optio
case PR_GETSTACKSIZE:
printk("irix_prctl[%s:%d]: Wants PR_GETSTACKSIZE\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = current->signal->rlim[RLIMIT_STACK].rlim_cur;
break;
case PR_MAXPPROCS:
printk("irix_prctl[%s:%d]: Wants PR_MAXPROCS\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = 1;
break;
case PR_UNBLKONEXEC:
printk("irix_prctl[%s:%d]: Wants PR_UNBLKONEXEC\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = -EINVAL;
break;
case PR_SETEXITSIG:
printk("irix_prctl[%s:%d]: Wants PR_SETEXITSIG\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
/* We can probably play some game where we set the task
* exit_code to some non-zero value when this is requested,
@@ -176,31 +176,31 @@ asmlinkage int irix_prctl(unsigned optio
case PR_RESIDENT:
printk("irix_prctl[%s:%d]: Wants PR_RESIDENT\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = 0; /* Compatibility indeed. */
break;
case PR_ATTACHADDR:
printk("irix_prctl[%s:%d]: Wants PR_ATTACHADDR\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = -EINVAL;
break;
case PR_DETACHADDR:
printk("irix_prctl[%s:%d]: Wants PR_DETACHADDR\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = -EINVAL;
break;
case PR_TERMCHILD:
printk("irix_prctl[%s:%d]: Wants PR_TERMCHILD\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = -EINVAL;
break;
case PR_GETSHMASK:
printk("irix_prctl[%s:%d]: Wants PR_GETSHMASK\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = -EINVAL; /* Until I have the sproc() stuff in. */
break;
@@ -210,19 +210,19 @@ asmlinkage int irix_prctl(unsigned optio
case PR_COREPID:
printk("irix_prctl[%s:%d]: Wants PR_COREPID\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = -EINVAL;
break;
case PR_ATTACHADDRPERM:
printk("irix_prctl[%s:%d]: Wants PR_ATTACHADDRPERM\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
error = -EINVAL;
break;
default:
printk("irix_prctl[%s:%d]: Non-existant opcode %d\n",
- current->comm, current->pid, option);
+ current->comm, task_pid(current), option);
error = -EINVAL;
break;
}
@@ -320,7 +320,7 @@ asmlinkage int irix_syssgi(struct pt_reg
retval = prom_setenv(name, value);
/* XXX make sure retval conforms to syssgi(2) */
printk("[%s:%d] setnvram(\"%s\", \"%s\"): retval %d",
- current->comm, current->pid, name, value, retval);
+ current->comm, task_pid(current), name, value, retval);
/* if (retval == PROM_ENOENT)
retval = -ENOENT; */
break;
@@ -330,7 +330,7 @@ asmlinkage int irix_syssgi(struct pt_reg
case SGI_SETPGID: {
#ifdef DEBUG_PROCGRPS
printk("[%s:%d] setpgid(%d, %d) ",
- current->comm, current->pid,
+ current->comm, task_pid(current),
(int) regs->regs[base + 5], (int)regs->regs[base + 6]);
#endif
retval = sys_setpgid(regs->regs[base + 5], regs->regs[base + 6]);
@@ -426,7 +426,7 @@ asmlinkage int irix_syssgi(struct pt_reg
case SGI_GETSID:
#ifdef DEBUG_PROCGRPS
- printk("[%s:%d] getsid(%d) ", current->comm, current->pid,
+ printk("[%s:%d] getsid(%d) ", current->comm, task_pid(current),
(int) regs->regs[base + 5]);
#endif
retval = sys_getsid(regs->regs[base + 5]);
@@ -582,7 +582,7 @@ out:
asmlinkage int irix_getpid(struct pt_regs *regs)
{
regs->regs[3] = current->real_parent->pid;
- return current->pid;
+ return task_pid(current);
}
asmlinkage int irix_getuid(struct pt_regs *regs)
@@ -680,7 +680,7 @@ asmlinkage int irix_mount(char __user *d
unsigned long flags, char __user *type, void __user *data, int datalen)
{
printk("[%s:%d] irix_mount(%p,%p,%08lx,%p,%p,%d)\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
dev_name, dir_name, flags, type, data, datalen);
return sys_mount(dev_name, dir_name, type, flags, data);
@@ -779,7 +779,7 @@ asmlinkage int irix_setpgrp(int flags)
int error;
#ifdef DEBUG_PROCGRPS
- printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags);
+ printk("[%s:%d] setpgrp(%d) ", current->comm, task_pid(current), flags);
#endif
if(!flags)
error = process_group(current);
@@ -849,7 +849,7 @@ asmlinkage int irix_exece(struct pt_regs
asmlinkage unsigned long irix_gethostid(void)
{
printk("[%s:%d]: irix_gethostid() called...\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
return -EINVAL;
}
@@ -857,7 +857,7 @@ asmlinkage unsigned long irix_gethostid(
asmlinkage unsigned long irix_sethostid(unsigned long val)
{
printk("[%s:%d]: irix_sethostid(%08lx) called...\n",
- current->comm, current->pid, val);
+ current->comm, task_pid(current), val);
return -EINVAL;
}
@@ -1082,7 +1082,7 @@ asmlinkage unsigned long irix_mmap32(uns
asmlinkage int irix_madvise(unsigned long addr, int len, int behavior)
{
printk("[%s:%d] Wheee.. irix_madvise(%08lx,%d,%d)\n",
- current->comm, current->pid, addr, len, behavior);
+ current->comm, task_pid(current), addr, len, behavior);
return -EINVAL;
}
@@ -1090,7 +1090,7 @@ asmlinkage int irix_madvise(unsigned lon
asmlinkage int irix_pagelock(char __user *addr, int len, int op)
{
printk("[%s:%d] Wheee.. irix_pagelock(%p,%d,%d)\n",
- current->comm, current->pid, addr, len, op);
+ current->comm, task_pid(current), addr, len, op);
return -EINVAL;
}
@@ -1098,7 +1098,7 @@ asmlinkage int irix_pagelock(char __user
asmlinkage int irix_quotactl(struct pt_regs *regs)
{
printk("[%s:%d] Wheee.. irix_quotactl()\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
return -EINVAL;
}
@@ -1108,14 +1108,14 @@ asmlinkage int irix_BSDsetpgrp(int pid,
int error;
#ifdef DEBUG_PROCGRPS
- printk("[%s:%d] BSDsetpgrp(%d, %d) ", current->comm, current->pid,
+ printk("[%s:%d] BSDsetpgrp(%d, %d) ", current->comm, task_pid(current),
pid, pgrp);
#endif
if(!pid)
- pid = current->pid;
+ pid = task_pid(current);
/* Wheee, weird sysv thing... */
- if ((pgrp == 0) && (pid == current->pid))
+ if ((pgrp == 0) && (pid == task_pid(current)))
error = sys_setsid();
else
error = sys_setpgid(pid, pgrp);
@@ -1130,7 +1130,7 @@ asmlinkage int irix_BSDsetpgrp(int pid,
asmlinkage int irix_systeminfo(int cmd, char __user *buf, int cnt)
{
printk("[%s:%d] Wheee.. irix_systeminfo(%d,%p,%d)\n",
- current->comm, current->pid, cmd, buf, cnt);
+ current->comm, task_pid(current), cmd, buf, cnt);
return -EINVAL;
}
@@ -1257,7 +1257,7 @@ asmlinkage int irix_xstat(int version, c
#ifdef DEBUG_XSTAT
printk("[%s:%d] Wheee.. irix_xstat(%d,%s,%p) ",
- current->comm, current->pid, version, filename, statbuf);
+ current->comm, task_pid(current), version, filename, statbuf);
#endif
retval = vfs_stat(filename, &stat);
@@ -1283,7 +1283,7 @@ asmlinkage int irix_lxstat(int version,
#ifdef DEBUG_XSTAT
printk("[%s:%d] Wheee.. irix_lxstat(%d,%s,%p) ",
- current->comm, current->pid, version, filename, statbuf);
+ current->comm, task_pid(current), version, filename, statbuf);
#endif
error = vfs_lstat(filename, &stat);
@@ -1310,7 +1310,7 @@ asmlinkage int irix_fxstat(int version,
#ifdef DEBUG_XSTAT
printk("[%s:%d] Wheee.. irix_fxstat(%d,%d,%p) ",
- current->comm, current->pid, version, fd, statbuf);
+ current->comm, task_pid(current), version, fd, statbuf);
#endif
error = vfs_fstat(fd, &stat);
@@ -1333,7 +1333,7 @@ asmlinkage int irix_xmknod(int ver, char
{
int retval;
printk("[%s:%d] Wheee.. irix_xmknod(%d,%s,%x,%x)\n",
- current->comm, current->pid, ver, filename, mode, dev);
+ current->comm, task_pid(current), ver, filename, mode, dev);
switch(ver) {
case 2:
@@ -1352,7 +1352,7 @@ asmlinkage int irix_xmknod(int ver, char
asmlinkage int irix_swapctl(int cmd, char __user *arg)
{
printk("[%s:%d] Wheee.. irix_swapctl(%d,%p)\n",
- current->comm, current->pid, cmd, arg);
+ current->comm, task_pid(current), cmd, arg);
return -EINVAL;
}
@@ -1372,7 +1372,7 @@ asmlinkage int irix_statvfs(char __user
int error, i;
printk("[%s:%d] Wheee.. irix_statvfs(%s,%p)\n",
- current->comm, current->pid, fname, buf);
+ current->comm, task_pid(current), fname, buf);
if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs)))
return -EFAULT;
@@ -1416,7 +1416,7 @@ asmlinkage int irix_fstatvfs(int fd, str
int error, i;
printk("[%s:%d] Wheee.. irix_fstatvfs(%d,%p)\n",
- current->comm, current->pid, fd, buf);
+ current->comm, task_pid(current), fd, buf);
if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs)))
return -EFAULT;
@@ -1457,7 +1457,7 @@ out:
asmlinkage int irix_priocntl(struct pt_regs *regs)
{
printk("[%s:%d] Wheee.. irix_priocntl()\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
return -EINVAL;
}
@@ -1465,7 +1465,7 @@ asmlinkage int irix_priocntl(struct pt_r
asmlinkage int irix_sigqueue(int pid, int sig, int code, int val)
{
printk("[%s:%d] Wheee.. irix_sigqueue(%d,%d,%d,%d)\n",
- current->comm, current->pid, pid, sig, code, val);
+ current->comm, task_pid(current), pid, sig, code, val);
return -EINVAL;
}
@@ -1568,7 +1568,7 @@ asmlinkage int irix_mmap64(struct pt_reg
asmlinkage int irix_dmi(struct pt_regs *regs)
{
printk("[%s:%d] Wheee.. irix_dmi()\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
return -EINVAL;
}
@@ -1577,7 +1577,7 @@ asmlinkage int irix_pread(int fd, char _
int off1, int off2)
{
printk("[%s:%d] Wheee.. irix_pread(%d,%p,%d,%d,%d,%d)\n",
- current->comm, current->pid, fd, buf, cnt, off64, off1, off2);
+ current->comm, task_pid(current), fd, buf, cnt, off64, off1, off2);
return -EINVAL;
}
@@ -1586,7 +1586,7 @@ asmlinkage int irix_pwrite(int fd, char
int off1, int off2)
{
printk("[%s:%d] Wheee.. irix_pwrite(%d,%p,%d,%d,%d,%d)\n",
- current->comm, current->pid, fd, buf, cnt, off64, off1, off2);
+ current->comm, task_pid(current), fd, buf, cnt, off64, off1, off2);
return -EINVAL;
}
@@ -1597,7 +1597,7 @@ asmlinkage int irix_sgifastpath(int cmd,
{
printk("[%s:%d] Wheee.. irix_fastpath(%d,%08lx,%08lx,%08lx,%08lx,"
"%08lx,%08lx)\n",
- current->comm, current->pid, cmd, arg0, arg1, arg2,
+ current->comm, task_pid(current), cmd, arg0, arg1, arg2,
arg3, arg4, arg5);
return -EINVAL;
@@ -1621,7 +1621,7 @@ asmlinkage int irix_statvfs64(char __use
int error, i;
printk("[%s:%d] Wheee.. irix_statvfs64(%s,%p)\n",
- current->comm, current->pid, fname, buf);
+ current->comm, task_pid(current), fname, buf);
if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs64))) {
error = -EFAULT;
goto out;
@@ -1667,7 +1667,7 @@ asmlinkage int irix_fstatvfs64(int fd, s
int error, i;
printk("[%s:%d] Wheee.. irix_fstatvfs64(%d,%p)\n",
- current->comm, current->pid, fd, buf);
+ current->comm, task_pid(current), fd, buf);
if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs))) {
error = -EFAULT;
@@ -1711,7 +1711,7 @@ asmlinkage int irix_getmountid(char __us
int err;
printk("[%s:%d] irix_getmountid(%s, %p)\n",
- current->comm, current->pid, fname, midbuf);
+ current->comm, task_pid(current), fname, midbuf);
if (!access_ok(VERIFY_WRITE, midbuf, (sizeof(unsigned long) * 4)))
return -EFAULT;
@@ -1733,7 +1733,7 @@ asmlinkage int irix_nsproc(unsigned long
unsigned long arg, unsigned long sp, int slen)
{
printk("[%s:%d] Wheee.. irix_nsproc(%08lx,%08lx,%08lx,%08lx,%d)\n",
- current->comm, current->pid, entry, mask, arg, sp, slen);
+ current->comm, task_pid(current), entry, mask, arg, sp, slen);
return -EINVAL;
}
@@ -1799,7 +1799,7 @@ asmlinkage int irix_ngetdents(unsigned i
#ifdef DEBUG_GETDENTS
printk("[%s:%d] ngetdents(%d, %p, %d, %p) ", current->comm,
- current->pid, fd, dirent, count, eob);
+ task_pid(current), fd, dirent, count, eob);
#endif
error = -EBADF;
file = fget(fd);
@@ -1898,7 +1898,7 @@ asmlinkage int irix_getdents64(int fd, v
#ifdef DEBUG_GETDENTS
printk("[%s:%d] getdents64(%d, %p, %d) ", current->comm,
- current->pid, fd, dirent, cnt);
+ task_pid(current), fd, dirent, cnt);
#endif
error = -EBADF;
if (!(file = fget(fd)))
@@ -1946,7 +1946,7 @@ asmlinkage int irix_ngetdents64(int fd,
#ifdef DEBUG_GETDENTS
printk("[%s:%d] ngetdents64(%d, %p, %d) ", current->comm,
- current->pid, fd, dirent, cnt);
+ task_pid(current), fd, dirent, cnt);
#endif
error = -EBADF;
if (!(file = fget(fd)))
@@ -1995,41 +1995,41 @@ asmlinkage int irix_uadmin(unsigned long
case 1:
/* Reboot */
printk("[%s:%d] irix_uadmin: Wants to reboot...\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 2:
/* Shutdown */
printk("[%s:%d] irix_uadmin: Wants to shutdown...\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 4:
/* Remount-root */
printk("[%s:%d] irix_uadmin: Wants to remount root...\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 8:
/* Kill all tasks. */
printk("[%s:%d] irix_uadmin: Wants to kill all tasks...\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 256:
/* Set magic mushrooms... */
printk("[%s:%d] irix_uadmin: Wants to set magic mushroom[%d]...\n",
- current->comm, current->pid, (int) func);
+ current->comm, task_pid(current), (int) func);
retval = -EINVAL;
goto out;
default:
printk("[%s:%d] irix_uadmin: Unknown operation [%d]...\n",
- current->comm, current->pid, (int) op);
+ current->comm, task_pid(current), (int) op);
retval = -EINVAL;
goto out;
};
@@ -2051,20 +2051,20 @@ asmlinkage int irix_utssys(char __user *
case 2:
/* ustat() */
printk("[%s:%d] irix_utssys: Wants to do ustat()\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 3:
/* fusers() */
printk("[%s:%d] irix_utssys: Wants to do fusers()\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
default:
printk("[%s:%d] irix_utssys: Wants to do unknown type[%d]\n",
- current->comm, current->pid, (int) type);
+ current->comm, task_pid(current), (int) type);
retval = -EINVAL;
goto out;
}
@@ -2083,7 +2083,7 @@ asmlinkage int irix_fcntl(int fd, int cm
#ifdef DEBUG_FCNTL
printk("[%s:%d] irix_fcntl(%d, %d, %d) ", current->comm,
- current->pid, fd, cmd, arg);
+ task_pid(current), fd, cmd, arg);
#endif
if (cmd == IRIX_F_ALLOCSP){
return 0;
@@ -2102,26 +2102,26 @@ asmlinkage int irix_ulimit(int cmd, int
switch(cmd) {
case 1:
printk("[%s:%d] irix_ulimit: Wants to get file size limit.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 2:
printk("[%s:%d] irix_ulimit: Wants to set file size limit.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 3:
printk("[%s:%d] irix_ulimit: Wants to get brk limit.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
case 4:
#if 0
printk("[%s:%d] irix_ulimit: Wants to get fd limit.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
#endif
@@ -2130,13 +2130,13 @@ asmlinkage int irix_ulimit(int cmd, int
case 5:
printk("[%s:%d] irix_ulimit: Wants to get txt offset.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
retval = -EINVAL;
goto out;
default:
printk("[%s:%d] irix_ulimit: Unknown command [%d].\n",
- current->comm, current->pid, cmd);
+ current->comm, task_pid(current), cmd);
retval = -EINVAL;
goto out;
}
@@ -2147,7 +2147,7 @@ out:
asmlinkage int irix_unimp(struct pt_regs *regs)
{
printk("irix_unimp [%s:%d] v0=%d v1=%d a0=%08lx a1=%08lx a2=%08lx "
- "a3=%08lx\n", current->comm, current->pid,
+ "a3=%08lx\n", current->comm, task_pid(current),
(int) regs->regs[2], (int) regs->regs[3],
regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]);
Index: linux-2.6.15-rc1/arch/mips/kernel/time.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/time.c
+++ linux-2.6.15-rc1/arch/mips/kernel/time.c
@@ -409,7 +409,7 @@ static long last_rtc_update;
*/
void local_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- if (current->pid)
+ if (task_pid(current))
profile_tick(CPU_PROFILING, regs);
update_process_times(user_mode(regs));
}
Index: linux-2.6.15-rc1/arch/mips/kernel/traps.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/kernel/traps.c
+++ linux-2.6.15-rc1/arch/mips/kernel/traps.c
@@ -267,7 +267,7 @@ void show_registers(struct pt_regs *regs
show_regs(regs);
print_modules();
printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
- current->comm, current->pid, current_thread_info(), current);
+ current->comm, task_pid(current), current_thread_info(), current);
show_stack(current, (long *) regs->regs[29]);
show_trace(current, (long *) regs->regs[29]);
show_code((unsigned int *) regs->cp0_epc);
Index: linux-2.6.15-rc1/arch/mips/mm/fault.c
===================================================================
--- linux-2.6.15-rc1.orig/arch/mips/mm/fault.c
+++ linux-2.6.15-rc1/arch/mips/mm/fault.c
@@ -43,7 +43,7 @@ asmlinkage void do_page_fault(struct pt_
#if 0
printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", smp_processor_id(),
- current->comm, current->pid, field, address, write,
+ current->comm, task_pid(current), field, address, write,
field, regs->cp0_epc);
#endif
@@ -172,7 +172,7 @@ no_context:
*/
out_of_memory:
up_read(&mm->mmap_sem);
- if (tsk->pid == 1) {
+ if (task_pid(tsk) == 1) {
yield();
down_read(&mm->mmap_sem);
goto survive;
--
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips
2005-11-14 21:23 ` [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips Serge E. Hallyn
@ 2005-11-15 23:08 ` Keith Owens
2005-11-16 11:58 ` Serge E. Hallyn
2005-11-16 13:53 ` Serge E. Hallyn
0 siblings, 2 replies; 86+ messages in thread
From: Keith Owens @ 2005-11-15 23:08 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, Hubertus Franke, Dave Hansen
On Mon, 14 Nov 2005 15:23:53 -0600,
"Serge E. Hallyn" <serue@us.ibm.com> wrote:
>Index: linux-2.6.15-rc1/arch/ia64/kernel/mca.c
>===================================================================
>--- linux-2.6.15-rc1.orig/arch/ia64/kernel/mca.c
>+++ linux-2.6.15-rc1/arch/ia64/kernel/mca.c
>@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt
> * (swapper or nested MCA/INIT) then use the start of the previous comm
> * field suffixed with its cpu.
> */
>- if (previous_current->pid)
>+ if (previous_task_pid(current))
> snprintf(comm, sizeof(comm), "%s %d",
>- current->comm, previous_current->pid);
>+ current->comm, previous_task_pid(current));
> else {
> int l;
> if ((p = strchr(previous_current->comm, ' ')))
That makes no sense, previous_task_pid() is not defined anywhere.
Looks like a global edit error and should probably be
task_pid(previous_current).
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips
2005-11-15 23:08 ` Keith Owens
@ 2005-11-16 11:58 ` Serge E. Hallyn
2005-11-16 13:53 ` Serge E. Hallyn
1 sibling, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-16 11:58 UTC (permalink / raw)
To: Keith Owens; +Cc: linux-kernel, Hubertus Franke, Dave Hansen
Quoting Keith Owens (kaos@sgi.com):
> On Mon, 14 Nov 2005 15:23:53 -0600,
> "Serge E. Hallyn" <serue@us.ibm.com> wrote:
> >Index: linux-2.6.15-rc1/arch/ia64/kernel/mca.c
> >===================================================================
> >--- linux-2.6.15-rc1.orig/arch/ia64/kernel/mca.c
> >+++ linux-2.6.15-rc1/arch/ia64/kernel/mca.c
> >@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt
> > * (swapper or nested MCA/INIT) then use the start of the previous comm
> > * field suffixed with its cpu.
> > */
> >- if (previous_current->pid)
> >+ if (previous_task_pid(current))
> > snprintf(comm, sizeof(comm), "%s %d",
> >- current->comm, previous_current->pid);
> >+ current->comm, previous_task_pid(current));
> > else {
> > int l;
> > if ((p = strchr(previous_current->comm, ' ')))
>
> That makes no sense, previous_task_pid() is not defined anywhere.
> Looks like a global edit error and should probably be
> task_pid(previous_current).
Yup, sure is.
thanks,
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips
2005-11-15 23:08 ` Keith Owens
2005-11-16 11:58 ` Serge E. Hallyn
@ 2005-11-16 13:53 ` Serge E. Hallyn
1 sibling, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-16 13:53 UTC (permalink / raw)
To: Keith Owens; +Cc: linux-kernel, Hubertus Franke, Dave Hansen
Quoting Keith Owens (kaos@sgi.com):
> On Mon, 14 Nov 2005 15:23:53 -0600,
> "Serge E. Hallyn" <serue@us.ibm.com> wrote:
> >Index: linux-2.6.15-rc1/arch/ia64/kernel/mca.c
> >===================================================================
> >--- linux-2.6.15-rc1.orig/arch/ia64/kernel/mca.c
> >+++ linux-2.6.15-rc1/arch/ia64/kernel/mca.c
> >@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt
> > * (swapper or nested MCA/INIT) then use the start of the previous comm
> > * field suffixed with its cpu.
> > */
> >- if (previous_current->pid)
> >+ if (previous_task_pid(current))
> > snprintf(comm, sizeof(comm), "%s %d",
> >- current->comm, previous_current->pid);
> >+ current->comm, previous_task_pid(current));
> > else {
> > int l;
> > if ((p = strchr(previous_current->comm, ' ')))
>
> That makes no sense, previous_task_pid() is not defined anywhere.
> Looks like a global edit error and should probably be
> task_pid(previous_current).
Note there are a few more ia64 errors - working on a test compile
now and will send out a new patch, though i don't have the hw to
boot-test.
thanks,
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* [RFC] [PATCH 13/13] Define new task_pid api
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (11 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips Serge E. Hallyn
@ 2005-11-14 21:23 ` Serge E. Hallyn
2005-11-14 23:36 ` [RFC] [PATCH 00/13] Introduce " Paul Jackson
` (3 subsequent siblings)
16 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-14 21:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Hubertus Franke, Dave Hansen
[-- Attachment #1: BC-define-pid-handlers --]
[-- Type: text/plain, Size: 1875 bytes --]
Replace-Subject: Define new task_pid api
From: Serge Hallyn <serue@us.ibm.com>
Actually define the task_pid() and task_tgid() functions. Also
replace pid with __pid so as to make sure any missed accessors are
caught.
The resulting object code seems to be identical in most cases, and is
actually shorter in cases where current->pid is used twice in a row,
as it does not dereference task-> twice.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
include/linux/sched.h | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
Index: linux-2.6.15-rc1/include/linux/sched.h
===================================================================
--- linux-2.6.15-rc1.orig/include/linux/sched.h
+++ linux-2.6.15-rc1/include/linux/sched.h
@@ -733,8 +733,8 @@ struct task_struct {
/* ??? */
unsigned long personality;
unsigned did_exec:1;
- pid_t pid;
- pid_t tgid;
+ pid_t __pid;
+ pid_t __tgid;
/*
* pointers to (original) parent process, youngest child, younger sibling,
* older sibling, respectively. (p->father can be replaced with
@@ -878,6 +878,16 @@ static inline int pid_alive(struct task_
return p->pids[PIDTYPE_PID].nr != 0;
}
+static inline pid_t task_pid(const struct task_struct *p)
+{
+ return p->__pid;
+}
+
+static inline pid_t task_tgid(const struct task_struct *p)
+{
+ return p->__tgid;
+}
+
extern void free_task(struct task_struct *tsk);
extern void __put_task_struct(struct task_struct *tsk);
#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
@@ -1202,7 +1212,7 @@ extern void wait_task_inactive(task_t *
extern task_t * FASTCALL(next_thread(const task_t *p));
-#define thread_group_leader(p) (p->pid == p->tgid)
+#define thread_group_leader(p) (task_pid(p) == task_tgid(p))
static inline int thread_group_empty(task_t *p)
{
--
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (12 preceding siblings ...)
2005-11-14 21:23 ` [RFC] [PATCH 13/13] Define new task_pid api Serge E. Hallyn
@ 2005-11-14 23:36 ` Paul Jackson
2005-11-15 1:01 ` Serge E. Hallyn
` (2 more replies)
2005-11-15 11:17 ` Robin Holt
` (2 subsequent siblings)
16 siblings, 3 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-14 23:36 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, frankeh, haveblue
How about adding the accessor routines in the first patch (still
referencing task->pid), then doing all the changes as you did, then
renaming task->pid to task->__pid and updating the accessor to that
change, in the last patch? Then it would build all the way through.
Serge wrote:
> The resulting object code seems to be identical in most cases, and is
> actually shorter in cases where current->pid is used twice in a row,
> as it does not dereference task-> twice.
You lost me here. Why does using these accessor routines avoid the
second reference?
Have you crosstool'd built this for most arch's? I could imagine
some piece of code having a local or other struct variable named 'pid'
that would be broken by a mistake in this change. This could be so
whether the change was done by a script, or by hand. Probably need
to test 'allyesconfig' too.
> Note that this does not change the kernel's
> internal idea of pids, only what users see.
How can that be? Doesn't it run all accesses to the task->pid
field through the accessor, regardless of whether it's something
the user will see, or something used within the kernel?
How about other fields holding a pid, such as (one I happen to know
about) kernel/cpuset.c marker_pid? Grep for "pid_t" in include/linux
for other such possible fields. What about other kerel-user interfaces
that deal with pids such as fcntl, msgctl, sched_setaffinity, semop,
shmctl, sigaction, ...
How do you propose to synchronize incoming pid's with these potentially
modified displayed pids? There many invocations of find_task_by_pid()
in the kernel, typically converting a user provided pid into a task
struct. If doing "kill(getpid(), 1)" in user code didn't sighup
myself, that would be uncool.
How do you intend to use these accessor routines in order to help solve
the problems with checkpoint/restart?
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-14 23:36 ` [RFC] [PATCH 00/13] Introduce " Paul Jackson
@ 2005-11-15 1:01 ` Serge E. Hallyn
2005-11-15 1:35 ` Paul Jackson
2005-11-15 1:51 ` Paul Jackson
2005-11-15 5:51 ` Serge E. Hallyn
2005-11-15 13:34 ` Serge E. Hallyn
2 siblings, 2 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 1:01 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> How about adding the accessor routines in the first patch (still
> referencing task->pid), then doing all the changes as you did, then
> renaming task->pid to task->__pid and updating the accessor to that
> change, in the last patch? Then it would build all the way through.
Ok, thanks - will send out a new patchset to do this.
>
> Serge wrote:
> > The resulting object code seems to be identical in most cases, and is
> > actually shorter in cases where current->pid is used twice in a row,
> > as it does not dereference task-> twice.
>
> You lost me here. Why does using these accessor routines avoid the
> second reference?
Why, I don't know :) I just looked at the resulting object code, and
the static inline causes task->pid to be dereferenced once and pushed
twice, whereas using task->pid causes it to be dereferenced twice.
> Have you crosstool'd built this for most arch's? I could imagine
No - I've never used crosstool, but will it a shot.
> > Note that this does not change the kernel's
> > internal idea of pids, only what users see.
>
> How can that be? Doesn't it run all accesses to the task->pid
> field through the accessor, regardless of whether it's something
> the user will see, or something used within the kernel?
Ok... our intent is to not change the kernel pid concept :) Of
course the accessor functions could be coded so as to change it, but
as far as I know we will not do so.
> How about other fields holding a pid, such as (one I happen to know
> about) kernel/cpuset.c marker_pid? Grep for "pid_t" in include/linux
> for other such possible fields. What about other kerel-user interfaces
> that deal with pids such as fcntl, msgctl, sched_setaffinity, semop,
> shmctl, sigaction, ...
Yes, our next patchset will introduce the actual pid to vpid translations
and place those functions in the right place. What I meant to say was
that the kernel pids will still be pids just as they are now. The barrier
between virtual pids and pids does not yet exist in this patchset. This
patchset is to lay the groundwork to make those translations simpler. We
switch task_pid() to task_vpid() in the right places, and use
task_pid_to_vpid() at the barriers between pids and vpids.
> How do you propose to synchronize incoming pid's with these potentially
> modified displayed pids? There many invocations of find_task_by_pid()
> in the kernel, typically converting a user provided pid into a task
These are replaced with find_task_by_vpid(), which looks for a the given
vpid in the pid-space of the calling process.
> struct. If doing "kill(getpid(), 1)" in user code didn't sighup
> myself, that would be uncool.
>
> How do you intend to use these accessor routines in order to help solve
> the problems with checkpoint/restart?
Let's say we want to start a process group. Start the first process in
a new pidspace. (Hubertus or Dave can tell use exactly how this will be
done in the first prototype, but I would expect something like
echo 5 > /proc/$$/childpidspace
start_my_program # This forks, and its children remain in pidspace 5
)
Now the processes in pidspace 5 are checkpointed and killed. When they
are restarted, they will create a new pidspace for the group again, and
ask for their checkpointed pids within that pidspace. Their kernelpids
will still be the same pid it would have been. But when one of the
processes looks for process 10, task_vpid_to_pid(current, 10) will return
the real pid for the vpid 10 in current's pidspace.
thanks,
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 1:01 ` Serge E. Hallyn
@ 2005-11-15 1:35 ` Paul Jackson
2005-11-15 1:51 ` Paul Jackson
1 sibling, 0 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 1:35 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, frankeh, haveblue
Serge wrote:
> Ok, thanks - will send out a new patchset to do this.
This one change probably isn't worth new patches.
At least keep this in mind next time. No biggie
either way.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 1:01 ` Serge E. Hallyn
2005-11-15 1:35 ` Paul Jackson
@ 2005-11-15 1:51 ` Paul Jackson
2005-11-15 2:29 ` Serge E. Hallyn
1 sibling, 1 reply; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 1:51 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, frankeh, haveblue
Serge wrote:
> But when one of the
> processes looks for process 10, task_vpid_to_pid(current, 10) will return
> the real pid for the vpid 10 in current's pidspace.
So a "kill -1 10" will mean different things, depending on the pidspace
that the kill is running in. And pid's passed about between user
tasks as if they were usable system-wide are now aliased by their
invisible pidspace.
Yuck. Such virtualizations usually have a much harder time addressing
the last 10% of situations than they did the easy 90%.
How about instead having a way to put the pid's of checkpointed tasks
in deep freeze, saving them for reuse when the task restarts?
System calls that operate on pid values could error out with some
new errno, -EFROZEN or some such.
This would seem far less invasive. Not just less invasive of the code,
but more importantly, not introducing some never entirely realizable
semantic change to the scope of pids.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 1:51 ` Paul Jackson
@ 2005-11-15 2:29 ` Serge E. Hallyn
2005-11-15 3:37 ` Paul Jackson
0 siblings, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 2:29 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> Serge wrote:
> > But when one of the
> > processes looks for process 10, task_vpid_to_pid(current, 10) will return
> > the real pid for the vpid 10 in current's pidspace.
>
> So a "kill -1 10" will mean different things, depending on the pidspace
> that the kill is running in. And pid's passed about between user
> tasks as if they were usable system-wide are now aliased by their
> invisible pidspace.
>
> Yuck. Such virtualizations usually have a much harder time addressing
> the last 10% of situations than they did the easy 90%.
For simplicity, the only pids a process will see are those in its own
pidspace, and the only controls (I expect) will be the ability to start
a new pidspace, and request a pid. So it is no more complicated than
the vserver model, where a process becomes pid 1 only for other proceses
in the same vserver, and process don't see processes in other vservers -
except that now every process in the pidspace can be known as a different
pid, not just the first.
> How about instead having a way to put the pid's of checkpointed tasks
> in deep freeze, saving them for reuse when the task restarts?
> System calls that operate on pid values could error out with some
> new errno, -EFROZEN or some such.
Unfortunately that would not work for checkpoints across boots, or, more
importantly, for process (set) migration.
> This would seem far less invasive. Not just less invasive of the code,
> but more importantly, not introducing some never entirely realizable
> semantic change to the scope of pids.
Hopefully the next patchset, implementing the pid-vpid split, will show
it's not as complicated as I've made it sound.
Of course, if it remains too complicated a conceptual change to be
mergeable, we're better off knowing that now...
thanks,
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 2:29 ` Serge E. Hallyn
@ 2005-11-15 3:37 ` Paul Jackson
2005-11-15 5:15 ` Serge E. Hallyn
0 siblings, 1 reply; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 3:37 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, frankeh, haveblue
Serge wrote:
> the vserver model
What's that?
> Unfortunately that would not work for checkpoints across boots,
That could be made to work, by an early init script that looked in the
"checkedpointed tasks storage locker" on disk, and reserved any pid's
used therein, marking them as frozen. A little care can ensure that
no task with such a pid is already running.
> or, more importantly, for process (set) migration.
Migration to a system that has already been up a while, where no
reservation of pid's was made ahead of time, hence where pid's overlap,
would not work with my EFROZEN scheme - you are right there.
How large is our numeric pid space (on 64 bit systems, anyway)? If
large enough, then reservation of pid ranges becomes an easy task. If
say we had 10 bits to spare, then a server farm could pre-ordain say a
thousand virtual servers, which come and go on various hardware
systems, each virtual server with its own hostname, pid-range, and
other such paraphernalia.
However there is an elephant in the room, or a camel outside the tent
or some such. Yes, the camel's nose may well fit inside the tent,
but before we invite his nose, we should have some idea if the rest
of the camel will fit.
In other words, since I don't see any compelling reason for this
virtualization of pids -except- for checkpoint/restart sorts of
features, the usefulness of pid virtualization would seem to rest on
the acceptability of the rest of the checkpoint/restart proposal.
For all I know now (not much) the amount of effort required to
sufficiently virtualize all the elements of the Linux kernel-user
interface enough to enable robust job migration across machines and
reboots may well make virtualizing the kernel's address space look easy.
Linux is not VM.
Hence, until sold on the larger direction, I am skeptical of this
first step.
Though, I will grant, I am interested too. A good Linux
checkpoint/restart solution would be valuable.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 3:37 ` Paul Jackson
@ 2005-11-15 5:15 ` Serge E. Hallyn
2005-11-15 6:35 ` Paul Jackson
2005-11-15 16:47 ` Greg KH
0 siblings, 2 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 5:15 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> Serge wrote:
> > the vserver model
>
> What's that?
:) Well a vserver pretends to be a full system of its own, though you
can have lots of vservers on one machine. Processes in each virtual
server see only other processes in the same vserver. However in
vserver the pids they see are the real kernel pids - except for one
process per vserver which can be the fakeinit. Other processes in the
same vserver see it as pid 1, but to the kernel it is still known by
its real pid.
> How large is our numeric pid space (on 64 bit systems, anyway)? If
> large enough, then reservation of pid ranges becomes an easy task. If
> say we had 10 bits to spare, then a server farm could pre-ordain say a
> thousand virtual servers, which come and go on various hardware
> systems, each virtual server with its own hostname, pid-range, and
> other such paraphernalia.
In fact this is one way we considered implementing the virtual pids -
the pidspace id would be the upper some bits of the pid, and the vpid
would be the lower bits, so that the kernel pid would simply be
(pidspace_id << some_shift | vpid).
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 5:15 ` Serge E. Hallyn
@ 2005-11-15 6:35 ` Paul Jackson
2005-11-15 8:11 ` Serge E. Hallyn
2005-11-15 16:47 ` Greg KH
1 sibling, 1 reply; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 6:35 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, frankeh, haveblue
Serge wrote:
> Well a vserver pretends to be a full system of its own
Do you have any references, links?
> In fact this is one way we considered implementing the virtual pids -
No no - not what I meant. I meant to have the pid be the same in all
views, for all time, kernel and user, inside and outside the virtual
server. Just like pids are now. A given virtual server would have
a dedicated range of pids, reserved for it on all hardware systems
in the farm.
You could move the tasks in one such virtual server from one hardware
system to another without having pid collisions because the destination
hardware system would have been reserving those pids all along for
that virtual server.
The additional kernel facilities this would require:
1) For a given task (inherited) designate which pid range to use for
newly forked children.
2) Restart a task into the same pid it had before, which would fail
if that pid was in use by any other task on the system.
Administratively, create named virtual servers, each one assigned
a permanent pid range. On each hardware system, each task would
be managed to be using pids for forking from the pid range for the
virtual server it was running in.
Perhaps each hardware system would have one pid range, say pids
0..2000, overlapping with all other such systems, for tasks specific
to that hardware system. These tasks could not be checkpoint/restarted
on another hardware system.
For example, the virtual server "magnolia" would always have pids
9,000 to 9,999, and all hardware systems in the server farm would
keep this pid range open for running "magnolia", if asked to. If you
saw a tasks pid was 9.543, then you would immediately know it ran
on virtual server "magnolia."
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 6:35 ` Paul Jackson
@ 2005-11-15 8:11 ` Serge E. Hallyn
2005-11-15 9:06 ` Paul Jackson
0 siblings, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 8:11 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> Serge wrote:
> > Well a vserver pretends to be a full system of its own
>
> Do you have any references, links?
Oh - linux-vserver.org
> > In fact this is one way we considered implementing the virtual pids -
>
> No no - not what I meant. I meant to have the pid be the same in all
> views, for all time, kernel and user, inside and outside the virtual
> server. Just like pids are now. A given virtual server would have
> a dedicated range of pids, reserved for it on all hardware systems
> in the farm.
But in the end isn't that more complicated than our approach? The
kernel still needs to be modified to let processes request their pids,
and now processes have to worry *always* about the value or range of
their pids, both at startup and restart. In the pidspace approach,
processes simply have a concept of starting a new pidspace, after
which the rest of the system processes are effectively gone as far as
this pidspace is concerned, and, other than that, processes continue
as normal. Upon restart, they do have to reclaim their vpids, either
from userspace, or through in-kernel restart code.
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 8:11 ` Serge E. Hallyn
@ 2005-11-15 9:06 ` Paul Jackson
2005-11-15 10:07 ` Dave Hansen
` (3 more replies)
0 siblings, 4 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 9:06 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, frankeh, haveblue
> But in the end isn't that more complicated than our approach? The
> kernel still needs to be modified to let processes request their pids,
No - getpid() works, as always. Perhaps I don't understand your
comment.
> and now processes have to worry *always* about the value or range of
> their pids, both at startup and restart.
No - tasks get the pid the kernel gives them at fork, as always.
The task keeps that exact same pid, across all checkpoints, restarts
and migrations. Nothing that the application process has to worry
about, either inside the kernel code or in userspace, beyond the fork
code honoring the assigned pid range when allocating a new pid.
No wide spread kernel code change, compared to yours. As now, tasks
have a pid field, and that pid is the same value, system-wide.
An additional per-task attribute, set by a batch manager typically
when it starts a job on a checkpointable, restartable, movable
"virtual server" connects the job parent task, and hence all its
descendents in that job, with a named kernel object that has among its
attributes a pid range. When fork is handing out new pids, it honors
that pid range. User level code, in the batch manager or system
administration layer manages a set of these named virtual servers,
including assigning pid ranges to them, and puts what is usually the
same such configuration on each server in the farm.
There will likely be other system-wide or job-wide name spaces and
associated resources that will need to be preserved across these
operations, such as shared memory, ipc, sockets, tmp files, signals,
locking, shared file descriptors, process tree, permissions, ulimits,
accounting, ... For each system-wide namespace, give each virtual
server a dedicated portion of that space, the same across all servers
in the farm. Where those names are kernel assigned, such as pids,
teach the kernel to assign within the specified portion, such as the
assigned pid range.
The real complexity comes, I claim, from changing the pid from a
system-wide name space to a partially per-job namespace. You can
never do that conversion entirely and will always have confusions
around the edges, as pids relative to one virtual server are used,
incorrectly, in the environment of another virtual server or system
wide.
The difficulty of things is best not measured by the effort to
do the first 90%, but by the effort to do the last 10%. And when
trying to reconcile two irreconcilable concepts, that last 10% can
never be completed.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 9:06 ` Paul Jackson
@ 2005-11-15 10:07 ` Dave Hansen
2005-11-15 18:10 ` Paul Jackson
2005-11-15 11:59 ` Robin Holt
` (2 subsequent siblings)
3 siblings, 1 reply; 86+ messages in thread
From: Dave Hansen @ 2005-11-15 10:07 UTC (permalink / raw)
To: Paul Jackson; +Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List, frankeh
On Tue, 2005-11-15 at 01:06 -0800, Paul Jackson wrote:
> No - tasks get the pid the kernel gives them at fork, as always.
> The task keeps that exact same pid, across all checkpoints, restarts
> and migrations. Nothing that the application process has to worry
> about, either inside the kernel code or in userspace, beyond the fork
> code honoring the assigned pid range when allocating a new pid.
The main issues I worry about with such a static allocation scheme are
getting the allocation patterns right, without causing new restrictions
on the containers. This kind of scheme is completely thrown out the
window if someone wanted to start a process on their disconnected laptop
and later migrate it to another machine when they connect back up to the
network.
> The real complexity comes, I claim, from changing the pid from a
> system-wide name space to a partially per-job namespace. You can
> never do that conversion entirely and will always have confusions
> around the edges, as pids relative to one virtual server are used,
> incorrectly, in the environment of another virtual server or system
> wide.
You're basically concerned about pids "leaking" across containers, and
confusing applications in the process? That's a pretty valid concern.
However, the long-term goal here is to virtualize more than pids. As
you noted, this will include thing like shm ids. Yes, I worry that
we'll end up modifying a _ton_ of stuff in the process of doing this.
As for passing confusing pids from different namespaces in the
filesystem, like in /var/run, there are solutions in the pipeline.
Private namespaces and versioned filesystems should be able to cope with
this kind of isolation very nicely.
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 10:07 ` Dave Hansen
@ 2005-11-15 18:10 ` Paul Jackson
0 siblings, 0 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 18:10 UTC (permalink / raw)
To: Dave Hansen; +Cc: serue, linux-kernel, frankeh
Well ... from your response, Dave, I think you understood what I was
saying. Thanks.
> The main issues I worry about with such a static allocation scheme are
> getting the allocation patterns right, without causing new restrictions
> on the containers.
Yes - the basic problem with pre-allocating static containers is that
you have to pre-allocate them ;).
> This kind of scheme is completely thrown out the
> window if someone wanted to start a process on their disconnected laptop
> and later migrate it to another machine when they connect back up to the
> network.
Transparent relocation without anticipating and preparing in _some_
way for that relocation prior to starting the job has the potential
to be one of those "Just say no to crazy requirements" moments. I am
sure some marketing folks don't agree.
> You're basically concerned about pids "leaking" across containers, and
> confusing applications in the process? That's a pretty valid concern.
Partly that, yes. Pids have been a system-wide notion since forever.
They get buried in lots of places and uses.
There is a natural tendency in these virtualization efforts to put
blinders on, and be encouraged by the potential ease of solving the
first 80% or 90% of the problem.
The kernel needs to be clear and consistent in what notions it
supports, avoiding getting caught between two inconsistent models
without a clear definition of which model applies when.
> we'll end up modifying a _ton_ of stuff in the process of doing this.
That's the kicker. Pid remapping seems useless by itself unless the
rest of this stuff is modified as well, to make a workable solution.
I'm looking for the larger design, before deciding on individual
patches.
My intuition is that somehow or other, jobs that have the potential
to be restarted or relocated have to start their life in a container
that isolates them.
My mind is wandering now to something Xen like, perhaps. Something
Open Source, available to us all, but with key virtualizations in
middleware rather then the kernel. See also the results of a Google
search on "checkpoint restart comparison zap" and the pods of Zap:
http://www.cs.cmu.edu/~sosman/publications/osdi2002/ZAP-OSDI.html.
This Zap paper is a good example of the design overview required to
motivate the individual patches needed to provide such a solution.
Their pod construct is not exactly what I was concocting in my
replies on this thread so far, but is far better thought out and more
persuasive, even to me.
A proposal that integrated a next generation Zap into the kernel
would be most interesting. We don't have to keep it isolated to a
loadable kernel module that hacks the system call table, which may
give us leverage on improving it in other ways.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 9:06 ` Paul Jackson
2005-11-15 10:07 ` Dave Hansen
@ 2005-11-15 11:59 ` Robin Holt
2005-11-15 13:32 ` Serge E. Hallyn
2005-11-15 19:00 ` Serge E. Hallyn
3 siblings, 0 replies; 86+ messages in thread
From: Robin Holt @ 2005-11-15 11:59 UTC (permalink / raw)
To: Paul Jackson; +Cc: Serge E. Hallyn, linux-kernel, frankeh, haveblue
On Tue, Nov 15, 2005 at 01:06:24AM -0800, Paul Jackson wrote:
> No - tasks get the pid the kernel gives them at fork, as always.
> The task keeps that exact same pid, across all checkpoints, restarts
> and migrations. Nothing that the application process has to worry
> about, either inside the kernel code or in userspace, beyond the fork
> code honoring the assigned pid range when allocating a new pid.
Paul, this approach seems very risky at best. How do you checkpoint,
stop, reboot the system, and restart? Does the system recall that a
checkpoint occured and then reserve those from early in boot? What about
a checkpointed task which is completed on a different system? How is
that handled? What if the checkpointed and terminated task is deemed
not worth restarting, how do you inform the system to reuse the pids.
Just seems like a hornets nest.
I would think _for_pids_and_not_everything, the checkpoint could write
out the core file and a restart file. The restart file would contain the
pid related information. Then the restart tool could use a preloader to
intercept system calls that specify pids and translate pids from old to
new. It might not be as easy as using the kernel, but it makes some sense
to from my limited point of view and makes the kernel code less polluted.
Robin
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 9:06 ` Paul Jackson
2005-11-15 10:07 ` Dave Hansen
2005-11-15 11:59 ` Robin Holt
@ 2005-11-15 13:32 ` Serge E. Hallyn
2005-11-15 14:37 ` Hubertus Franke
2005-11-15 19:00 ` Serge E. Hallyn
3 siblings, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 13:32 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> > But in the end isn't that more complicated than our approach? The
> > kernel still needs to be modified to let processes request their pids,
>
> No - getpid() works, as always. Perhaps I don't understand your
> comment.
>
>
> > and now processes have to worry *always* about the value or range of
> > their pids, both at startup and restart.
>
> No - tasks get the pid the kernel gives them at fork, as always.
> The task keeps that exact same pid, across all checkpoints, restarts
> and migrations. Nothing that the application process has to worry
> about, either inside the kernel code or in userspace, beyond the fork
> code honoring the assigned pid range when allocating a new pid.
Ok, so we have fork code to dole out pid ranges per vserver, I see where
the app doesn't need to request a pid on startup. But what about restart?
Surely the app still needs to be restarted with the same pid - just that
now we are more trusting that the pid remains available bc of the pid
ranges?
> No wide spread kernel code change, compared to yours. As now, tasks
Note that while the patch is large, so far its main purpose is to introduce
a clean concept rather than hack the vpid idea in. The latter has beem done
before, and only requires intercepting the points where pids go from user
to kernel. This leaves the question of which pid is which more ambiguous.
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 13:32 ` Serge E. Hallyn
@ 2005-11-15 14:37 ` Hubertus Franke
2005-11-15 18:39 ` Paul Jackson
0 siblings, 1 reply; 86+ messages in thread
From: Hubertus Franke @ 2005-11-15 14:37 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Paul Jackson, linux-kernel, haveblue
Serge E. Hallyn wrote:
> Quoting Paul Jackson (pj@sgi.com):
>
There have been a few suggestions going fro and back.
Let me address them all at once.
(A) why a vpid?
For transparent checkpointing. Vserver for instance has not implemented
a checkpoint/restart yet, because without this concept it is not possible.
The moment you want transparent checkpoint, you need to deal with the fact
that the results of a getpid() are in register (worst case) and upon
restart the system must provide the same pid on the different machine.
That immediately suggest pid range reservation... but see point (B) below.
(B) syscall interception and LD_PRELOAD:
In principle that is possible, but it leads to potentially inefficient code
and at large leaves the issue of pid space creation and migration on the table.
However it makes clear that as long as I keep the transformation or mappings
consistent between virtual and real, that this is a quite useful concept.
The question now is how deep into the kernel do I have to drive it in order to
create an efficient implementation.
(C) Fixed PID range allocation:
That is completely unscalable and unnecessary:
First PID range allocation at a global level (e.g. cluster level) requires some agent.
Given that PID_MAX ~ 2**22 leaves us on 32-bit architectures with only 512 pidspaces (negative
range needs to be preserved I think).
However it is not unreasonable to assume that 512 different pidspaces per OS image is not
a restriction.
Hence, when a pidspace is migrated it will be assigned a different pidspace id.
Then going with kernelpid = (pidspace_id << 22) | vpid is an efficient means to
map between virtual pidspace and physical pidspace and vice versa.
All that needs to be managed is local pidspace allocation.
The translations from vpid <-> pid are very light weight as can be seen from the above
composition.
Take for example the vserver system. A local vserver agent could maintain the
pidspace allocation. On creation of a vserver it assigns the next available pidspace.
That pidspace id is internal to vserver and is not exported as a property of a vserver.
When a vserver is migrated to a different machine, a potentially different pidspace
is allocate, yet all the vpids remain the same.
(D) Cross compilation
I do all stuff on s390 so that space is covered.
If I missed some of the issues that were raised let me know and we will try to address
those.
I am part of Serge's team and have been working on intercepting the various places
where virtual to real pid translations have to occur in the kernel.
It's still in pretty bad shape, but it boots for the default pid space (:- ).
Of my head I say there are about 40 places each to do the translation.
Many are in the /proc/fs, some in the signal handling
I hope by end of the week I have something to post that gives idea how we are thinking
this could be realized.
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 14:37 ` Hubertus Franke
@ 2005-11-15 18:39 ` Paul Jackson
2005-11-15 18:54 ` Hubertus Franke
0 siblings, 1 reply; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 18:39 UTC (permalink / raw)
To: Hubertus Franke; +Cc: serue, linux-kernel, haveblue
I don't think that the checkpoint/restart/relocation design should be
driven by mico-optimizations of getpid(). It needs to be driven by
a design that addresses (for better or worse) the many larger questions
encountered in such an effort.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 18:39 ` Paul Jackson
@ 2005-11-15 18:54 ` Hubertus Franke
0 siblings, 0 replies; 86+ messages in thread
From: Hubertus Franke @ 2005-11-15 18:54 UTC (permalink / raw)
To: Paul Jackson; +Cc: serue, linux-kernel, haveblue
Paul Jackson wrote:
> I don't think that the checkpoint/restart/relocation design should be
> driven by mico-optimizations of getpid(). It needs to be driven by
> a design that addresses (for better or worse) the many larger questions
> encountered in such an effort.
>
Neither did we suggest one.
My note, was simply addressing some of the issues that were thrown out
with the alternative articulated in the many responses.
-- Hubertus
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 9:06 ` Paul Jackson
` (2 preceding siblings ...)
2005-11-15 13:32 ` Serge E. Hallyn
@ 2005-11-15 19:00 ` Serge E. Hallyn
2005-11-15 19:17 ` Hubertus Franke
2005-11-15 22:11 ` Paul Jackson
3 siblings, 2 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 19:00 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> An additional per-task attribute, set by a batch manager typically
> when it starts a job on a checkpointable, restartable, movable
> "virtual server" connects the job parent task, and hence all its
> descendents in that job, with a named kernel object that has among its
> attributes a pid range. When fork is handing out new pids, it honors
> that pid range. User level code, in the batch manager or system
> administration layer manages a set of these named virtual servers,
> including assigning pid ranges to them, and puts what is usually the
> same such configuration on each server in the farm.
I guess the one thing I really don't see supported here (apart from the
system/laptop joins the network after spawning a job which has been
mentioned) is restarting multiple simulatenous instances of a single
checkpoint. In the pidspace approach, each restarted instance would
have a different pidspace id, but use the same vpids. In the
preallocation scheme, only one pid has been reserved at checkpoint for
each process instance.
Is there a simple way to solve this? (And how valid a concern is
this? :)
Other than that, I guess your approach is growing on me...
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 19:00 ` Serge E. Hallyn
@ 2005-11-15 19:17 ` Hubertus Franke
2005-11-15 22:11 ` Paul Jackson
1 sibling, 0 replies; 86+ messages in thread
From: Hubertus Franke @ 2005-11-15 19:17 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Paul Jackson, linux-kernel, haveblue
Serge E. Hallyn wrote:
> Quoting Paul Jackson (pj@sgi.com):
>
>>An additional per-task attribute, set by a batch manager typically
>>when it starts a job on a checkpointable, restartable, movable
>>"virtual server" connects the job parent task, and hence all its
>>descendents in that job, with a named kernel object that has among its
>>attributes a pid range. When fork is handing out new pids, it honors
>>that pid range. User level code, in the batch manager or system
>>administration layer manages a set of these named virtual servers,
>>including assigning pid ranges to them, and puts what is usually the
>>same such configuration on each server in the farm.
>
And that's how we implement this.
The difference is that the pidrange-id is assigned on the fly,
that is when the virtual server is created or recreated after restart.
This, as described in my previous note, is more scalable, because I don't have
to do a global pidrange partitioning.
global pidrange partitioning has implications, for instance what if I simply
want to freeze an app only to restart it much later. This would freeze that
range autmatically.
On process restart, we force fork to use a particular <pidspace/pid> for its
kernel pid assignment, rather then searching for a free one.
-- Hubertus
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 19:00 ` Serge E. Hallyn
2005-11-15 19:17 ` Hubertus Franke
@ 2005-11-15 22:11 ` Paul Jackson
2005-11-15 23:15 ` Cedric Le Goater
1 sibling, 1 reply; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 22:11 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, frankeh, haveblue
Serge wrote:
> restarting multiple simulatenous instances of a single
> checkpoint. ... Is there a simple way to solve this?
> (And how valid a concern is this? :)
Offhand, I don't see a way to resolve it in the preallocation scheme.
That's not on my list of stuff to worry about. But, who knows,
someone else might find that a valid concern.
> Other than that, I guess your approach is growing on me...
Oh dear. I'm drifting away from advocating a pid-range preallocation
and toward thinking we need a more systematic approach, design and
architecture. This isn't just pids. Simple range based preallocation
won't help much on some of the other resources that we need to virtualize.
The Zap pods are sounding good to me right now, properly embedded
in the kernel rather than hacking the syscall table via a module.
In any case, I am suspecting that starting the job in some sort
of nice container should be a prerequisite for relocating or
checkpoint/restarting the job.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 22:11 ` Paul Jackson
@ 2005-11-15 23:15 ` Cedric Le Goater
2005-11-15 23:28 ` Paul Jackson
0 siblings, 1 reply; 86+ messages in thread
From: Cedric Le Goater @ 2005-11-15 23:15 UTC (permalink / raw)
To: Paul Jackson; +Cc: Serge E. Hallyn, linux-kernel, frankeh, haveblue
Paul Jackson wrote:
> Oh dear. I'm drifting away from advocating a pid-range preallocation
> and toward thinking we need a more systematic approach, design and
> architecture. This isn't just pids. Simple range based preallocation
> won't help much on some of the other resources that we need to virtualize.
Ah ! you said the word: "virtualize".
> The Zap pods are sounding good to me right now, properly embedded
> in the kernel rather than hacking the syscall table via a module.
hacking the syscall table via a module is evil and does not work. You can't
hack pids in a signal siginfo that way, you won't support NPTL, etc.
> In any case, I am suspecting that starting the job in some sort
> of nice container should be a prerequisite for relocating or
> checkpoint/restarting the job.
Indeed. Did you ever think about using PAGG as a foundation for a
checkpoint/restart container ?
Aggregation and isolation are key requirements for checkpoint/restart. And
then, the next one that comes on the list is private namespace or
virtualization, depends how you call it :)
C.
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 23:15 ` Cedric Le Goater
@ 2005-11-15 23:28 ` Paul Jackson
0 siblings, 0 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 23:28 UTC (permalink / raw)
To: Cedric Le Goater; +Cc: serue, linux-kernel, frankeh, haveblue
Cedric wrote:
> Indeed. Did you ever think about using PAGG as a foundation for a
> checkpoint/restart container ?
Other than the name, I didn't realize that PAGG provided a
good foundation for this work. However, I should let my
PAGG colleagues address that further if worthwhile.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 5:15 ` Serge E. Hallyn
2005-11-15 6:35 ` Paul Jackson
@ 2005-11-15 16:47 ` Greg KH
2005-11-15 17:08 ` Serge E. Hallyn
2005-11-15 17:33 ` Dave Hansen
1 sibling, 2 replies; 86+ messages in thread
From: Greg KH @ 2005-11-15 16:47 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Paul Jackson, linux-kernel, frankeh, haveblue
On Mon, Nov 14, 2005 at 11:15:01PM -0600, Serge E. Hallyn wrote:
> Quoting Paul Jackson (pj@sgi.com):
> > Serge wrote:
> > > the vserver model
> >
> > What's that?
>
> :) Well a vserver pretends to be a full system of its own, though you
> can have lots of vservers on one machine. Processes in each virtual
> server see only other processes in the same vserver. However in
> vserver the pids they see are the real kernel pids - except for one
> process per vserver which can be the fakeinit. Other processes in the
> same vserver see it as pid 1, but to the kernel it is still known by
> its real pid.
Why not just use Xen? It can handle process migration from one virtual
machine to another just fine.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 16:47 ` Greg KH
@ 2005-11-15 17:08 ` Serge E. Hallyn
2005-11-15 17:33 ` Dave Hansen
1 sibling, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 17:08 UTC (permalink / raw)
To: Greg KH; +Cc: Paul Jackson, linux-kernel, frankeh, haveblue
Quoting Greg KH (greg@kroah.com):
> On Mon, Nov 14, 2005 at 11:15:01PM -0600, Serge E. Hallyn wrote:
> > Quoting Paul Jackson (pj@sgi.com):
> > > Serge wrote:
> > > > the vserver model
> > >
> > > What's that?
> >
> > :) Well a vserver pretends to be a full system of its own, though you
> > can have lots of vservers on one machine. Processes in each virtual
> > server see only other processes in the same vserver. However in
> > vserver the pids they see are the real kernel pids - except for one
> > process per vserver which can be the fakeinit. Other processes in the
> > same vserver see it as pid 1, but to the kernel it is still known by
> > its real pid.
>
> Why not just use Xen? It can handle process migration from one virtual
> machine to another just fine.
It handles vm migration, but not process migration. The most compelling
thing (imo) which the latter allows you to do is live OS upgrade under
an application. Xen won't let you do that. Of course load-balancing is
also more fine-grained and powerful with process set migration, and
the overhead of a full OS per migrateable job is quite heavy.
That's not to say we don't also want to use Xen :) - it has it's own
advantages and I'm not intending to denigrate those. We just hope to
get both!
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 16:47 ` Greg KH
2005-11-15 17:08 ` Serge E. Hallyn
@ 2005-11-15 17:33 ` Dave Hansen
1 sibling, 0 replies; 86+ messages in thread
From: Dave Hansen @ 2005-11-15 17:33 UTC (permalink / raw)
To: Greg KH
Cc: SERGE E. HALLYN [imap], Paul Jackson, Linux Kernel Mailing List,
frankeh
On Tue, 2005-11-15 at 08:47 -0800, Greg KH wrote:
> Why not just use Xen? It can handle process migration from one virtual
> machine to another just fine.
Xen is relatively slow compared to the approach that we want to use.
It's a pain in the neck to set up, especially if you want a _lot_ of
partitions. We were going to try to compare the relative performance of
the two approaches as as the number of vservers and Xen VMs is
increased. We haven't found anyone brave enough to set up 100 Xen
guests on a single system. :)
The overhead of storing the application snapshots that we're envisioning
can be quite tiny compared to Xen. This becomes horribly important if
you want to store the snapshots for a bit, and not simply keep one
around for long enough to restore the image elsewhere.
Xen doesn't share Linux caches between partitions. So, as you increase
the number of Xen partitions, the overhead of storing things like the
'/' dentry goes up pretty linearly. Keeping only one Linux instance
around makes such things much nicer to share.
The laundry-list of advantages is pretty long. This is starting to
sound like a good OLS paper :)
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-14 23:36 ` [RFC] [PATCH 00/13] Introduce " Paul Jackson
2005-11-15 1:01 ` Serge E. Hallyn
@ 2005-11-15 5:51 ` Serge E. Hallyn
2005-11-13 15:22 ` Pavel Machek
2005-11-15 13:34 ` Serge E. Hallyn
2 siblings, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 5:51 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> Have you crosstool'd built this for most arch's? I could imagine
> some piece of code having a local or other struct variable named 'pid'
> that would be broken by a mistake in this change. This could be so
> whether the change was done by a script, or by hand. Probably need
> to test 'allyesconfig' too.
Argh - in fact it appears I compiled and booted my 2.6.14 version,
not this 2.6.15-rc1 version. Another patch is needed for this to
compile and boot (on a power5 system, in addition to a patch pending
for -mm to make rpaphp_pci compile). Sorry.
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
block/cfq-iosched.c | 4 ++--
block/ll_rw_blk.c | 2 +-
kernel/ptrace.c | 2 +-
net/llc/af_llc.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
Index: linux-2.6.14/kernel/ptrace.c
===================================================================
--- linux-2.6.14.orig/kernel/ptrace.c 2005-11-14 22:52:24.000000000 -0600
+++ linux-2.6.14/kernel/ptrace.c 2005-11-14 22:54:37.000000000 -0600
@@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *ta
retval = -EPERM;
if (task_pid(task) <= 1)
goto bad;
- if (task->tgid == current->tgid)
+ if (task_tgid(task) == task_tgid(current))
goto bad;
/* the same process cannot be attached many times */
if (task->ptrace & PT_PTRACED)
Index: linux-2.6.14/block/ll_rw_blk.c
===================================================================
--- linux-2.6.14.orig/block/ll_rw_blk.c 2005-11-14 22:52:07.000000000 -0600
+++ linux-2.6.14/block/ll_rw_blk.c 2005-11-14 23:07:51.000000000 -0600
@@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)
if (unlikely(block_dump)) {
char b[BDEVNAME_SIZE];
printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
- current->comm, current->pid,
+ current->comm, task_pid(current),
(rw & WRITE) ? "WRITE" : "READ",
(unsigned long long)bio->bi_sector,
bdevname(bio->bi_bdev,b));
Index: linux-2.6.14/block/cfq-iosched.c
===================================================================
--- linux-2.6.14.orig/block/cfq-iosched.c 2005-11-14 22:52:07.000000000 -0600
+++ linux-2.6.14/block/cfq-iosched.c 2005-11-14 23:08:44.000000000 -0600
@@ -621,7 +621,7 @@ cfq_reposition_crq_rb(struct cfq_queue *
static struct request *cfq_find_rq_rb(struct cfq_data *cfqd, sector_t sector)
{
- struct cfq_queue *cfqq = cfq_find_cfq_hash(cfqd, current->pid, CFQ_KEY_ANY);
+ struct cfq_queue *cfqq = cfq_find_cfq_hash(cfqd, task_pid(current), CFQ_KEY_ANY);
struct rb_node *n;
if (!cfqq)
@@ -1754,7 +1754,7 @@ static void cfq_prio_boost(struct cfq_qu
static inline pid_t cfq_queue_pid(struct task_struct *task, int rw)
{
if (rw == READ || process_sync(task))
- return task->pid;
+ return task_pid(task);
return CFQ_KEY_ASYNC;
}
Index: linux-2.6.14/net/llc/af_llc.c
===================================================================
--- linux-2.6.14.orig/net/llc/af_llc.c 2005-10-27 19:02:08.000000000 -0500
+++ linux-2.6.14/net/llc/af_llc.c 2005-11-14 23:09:44.000000000 -0600
@@ -757,7 +757,7 @@ static int llc_ui_recvmsg(struct kiocb *
if (net_ratelimit())
printk(KERN_DEBUG "LLC(%s:%d): Application "
"bug, race in MSG_PEEK.\n",
- current->comm, current->pid);
+ current->comm, task_pid(current));
peek_seq = llc->copied_seq;
}
continue;
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 5:51 ` Serge E. Hallyn
@ 2005-11-13 15:22 ` Pavel Machek
2005-11-16 19:36 ` Kyle Moffett
2005-11-16 20:24 ` Dave Hansen
0 siblings, 2 replies; 86+ messages in thread
From: Pavel Machek @ 2005-11-13 15:22 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Paul Jackson, linux-kernel, frankeh, haveblue
> > Have you crosstool'd built this for most arch's? I could imagine
> > some piece of code having a local or other struct variable named 'pid'
> > that would be broken by a mistake in this change. This could be so
> > whether the change was done by a script, or by hand. Probably need
> > to test 'allyesconfig' too.
>
> Argh - in fact it appears I compiled and booted my 2.6.14 version,
> not this 2.6.15-rc1 version. Another patch is needed for this to
> compile and boot (on a power5 system, in addition to a patch pending
> for -mm to make rpaphp_pci compile). Sorry.
> @@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)
> if (unlikely(block_dump)) {
> char b[BDEVNAME_SIZE];
> printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
> - current->comm, current->pid,
> + current->comm, task_pid(current),
> (rw & WRITE) ? "WRITE" : "READ",
> (unsigned long long)bio->bi_sector,
> bdevname(bio->bi_bdev,b));
...and now printk is close to useless, because uer can't know to which
pidspace that pid belongs. Oops.
--
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-13 15:22 ` Pavel Machek
@ 2005-11-16 19:36 ` Kyle Moffett
2005-11-16 20:36 ` Pavel Machek
2005-11-16 20:24 ` Dave Hansen
1 sibling, 1 reply; 86+ messages in thread
From: Kyle Moffett @ 2005-11-16 19:36 UTC (permalink / raw)
To: Pavel Machek
Cc: Serge E. Hallyn, Paul Jackson, linux-kernel, frankeh, haveblue
On Nov 13, 2005, at 10:22, Pavel Machek wrote:
>> @@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)
>> if (unlikely(block_dump)) {
>> char b[BDEVNAME_SIZE];
>> printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
>> - current->comm, current->pid,
>> + current->comm, task_pid(current),
>> (rw & WRITE) ? "WRITE" : "READ",
>> (unsigned long long)bio->bi_sector,
>> bdevname(bio->bi_bdev,b));
>
> ...and now printk is close to useless, because uer can't know to
> which pidspace that pid belongs. Oops.
Uhh, this patch doesn't introduce any kind of virtualization yet.
When that happens, _this_ code will remain the same (it wants the
real pid), but *other* code will switch to use task_vpid(current)
instead. This is an extremely literal translation of current->pid to
task_pid(current), both of which do exactly the same thing.
Cheers,
Kyle Moffett
--
There is no way to make Linux robust with unreliable memory
subsystems, sorry. It would be like trying to make a human more
robust with an unreliable O2 supply. Memory just has to work.
-- Andi Kleen
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-16 19:36 ` Kyle Moffett
@ 2005-11-16 20:36 ` Pavel Machek
2005-11-16 20:48 ` Dave Hansen
2005-11-16 21:07 ` Paul Jackson
0 siblings, 2 replies; 86+ messages in thread
From: Pavel Machek @ 2005-11-16 20:36 UTC (permalink / raw)
To: Kyle Moffett
Cc: Serge E. Hallyn, Paul Jackson, linux-kernel, frankeh, haveblue
Hi!
> >>@@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)
> >> if (unlikely(block_dump)) {
> >> char b[BDEVNAME_SIZE];
> >> printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
> >>- current->comm, current->pid,
> >>+ current->comm, task_pid(current),
> >> (rw & WRITE) ? "WRITE" : "READ",
> >> (unsigned long long)bio->bi_sector,
> >> bdevname(bio->bi_bdev,b));
> >
> >...and now printk is close to useless, because uer can't know to
> >which pidspace that pid belongs. Oops.
>
> Uhh, this patch doesn't introduce any kind of virtualization yet.
> When that happens, _this_ code will remain the same (it wants the
> real pid), but *other* code will switch to use task_vpid(current)
> instead. This is an extremely literal translation of current->pid to
> task_pid(current), both of which do exactly the same thing.
Hmm... it is hard to judge a patch without context. Anyway, can't we
get process snasphot/resume without virtualizing pids? Could we switch
to 128-bits so that pids are never reused or something like that?
Pavel
--
Thanks, Sharp!
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-16 20:36 ` Pavel Machek
@ 2005-11-16 20:48 ` Dave Hansen
2005-11-19 23:30 ` Pavel Machek
2005-11-16 21:07 ` Paul Jackson
1 sibling, 1 reply; 86+ messages in thread
From: Dave Hansen @ 2005-11-16 20:48 UTC (permalink / raw)
To: Pavel Machek
Cc: Kyle Moffett, SERGE E. HALLYN [imap], Paul Jackson,
Linux Kernel Mailing List, frankeh
On Wed, 2005-11-16 at 21:36 +0100, Pavel Machek wrote:
> Hmm... it is hard to judge a patch without context. Anyway, can't we
> get process snasphot/resume without virtualizing pids? Could we switch
> to 128-bits so that pids are never reused or something like that?
That might work fine for a managed cluster, but it wouldn't be a good
fit if you ever wanted to support something like a laptop in
disconnected operation, or if you ever want to restore the same snapshot
more than once. There may also be some practical userspace issues
making pids that large.
I also hate bloating types and making them sparse just for the hell of
it. It is seriously demoralizing to do a ps and see
7011827128432950176177290 staring back at you. :)
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-16 20:48 ` Dave Hansen
@ 2005-11-19 23:30 ` Pavel Machek
2005-11-20 22:38 ` Serge E. Hallyn
2005-11-20 23:29 ` Nix
0 siblings, 2 replies; 86+ messages in thread
From: Pavel Machek @ 2005-11-19 23:30 UTC (permalink / raw)
To: Dave Hansen
Cc: Kyle Moffett, SERGE E. HALLYN [imap], Paul Jackson,
Linux Kernel Mailing List, frankeh
Hi!
> > Hmm... it is hard to judge a patch without context. Anyway, can't we
> > get process snasphot/resume without virtualizing pids? Could we switch
> > to 128-bits so that pids are never reused or something like that?
>
> That might work fine for a managed cluster, but it wouldn't be a good
> fit if you ever wanted to support something like a laptop in
> disconnected operation, or if you ever want to restore the same snapshot
> more than once. There may also be some practical userspace issues
> making pids that large.
>
> I also hate bloating types and making them sparse just for the hell of
> it. It is seriously demoralizing to do a ps and see
> 7011827128432950176177290 staring back at you. :)
Well, doing cat /var/something/foo.pid, and seeing pid of unrelated process
is wrong, too... especially if you try to kill it....
--
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-19 23:30 ` Pavel Machek
@ 2005-11-20 22:38 ` Serge E. Hallyn
2005-12-07 14:53 ` Eric W. Biederman
2005-11-20 23:29 ` Nix
1 sibling, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-20 22:38 UTC (permalink / raw)
To: Pavel Machek
Cc: Dave Hansen, Kyle Moffett, Paul Jackson,
Linux Kernel Mailing List, frankeh
Quoting Pavel Machek (pavel@ucw.cz):
> Hi!
>
> > > Hmm... it is hard to judge a patch without context. Anyway, can't we
> > > get process snasphot/resume without virtualizing pids? Could we switch
> > > to 128-bits so that pids are never reused or something like that?
> >
> > That might work fine for a managed cluster, but it wouldn't be a good
> > fit if you ever wanted to support something like a laptop in
> > disconnected operation, or if you ever want to restore the same snapshot
> > more than once. There may also be some practical userspace issues
> > making pids that large.
> >
> > I also hate bloating types and making them sparse just for the hell of
> > it. It is seriously demoralizing to do a ps and see
> > 7011827128432950176177290 staring back at you. :)
>
> Well, doing cat /var/something/foo.pid, and seeing pid of unrelated process
> is wrong, too... especially if you try to kill it....
Good point. However the foo.pid scheme is incompatible with
checkpoint/restart and migration regardless.
a. what good is trying to kill something using such a file if
the process is checkpointed+killed, to be restarted later?
b. it is expected that any files used by a checkpointable
processes exist on a network fs, so that the fd can be moved.
What good is foo.pid if it's on a network filesystem?
So if you wanted to checkpoint and restart/migrate a process with a
foo.pid type of file, you might need to start it with a private
tmpfs in a private namespace. That part is trivial to do as part
of the management tools, though checkpointing a whole tmpfs per process
could be unfortunate.
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-20 22:38 ` Serge E. Hallyn
@ 2005-12-07 14:53 ` Eric W. Biederman
0 siblings, 0 replies; 86+ messages in thread
From: Eric W. Biederman @ 2005-12-07 14:53 UTC (permalink / raw)
To: Serge E. Hallyn
Cc: Pavel Machek, Dave Hansen, Kyle Moffett, Paul Jackson,
Linux Kernel Mailing List, frankeh
"Serge E. Hallyn" <serue@us.ibm.com> writes:
> Quoting Pavel Machek (pavel@ucw.cz):
>> Hi!
>>
>> > > Hmm... it is hard to judge a patch without context. Anyway, can't we
>> > > get process snasphot/resume without virtualizing pids? Could we switch
>> > > to 128-bits so that pids are never reused or something like that?
>> >
>> > That might work fine for a managed cluster, but it wouldn't be a good
>> > fit if you ever wanted to support something like a laptop in
>> > disconnected operation, or if you ever want to restore the same snapshot
>> > more than once. There may also be some practical userspace issues
>> > making pids that large.
>> >
>> > I also hate bloating types and making them sparse just for the hell of
>> > it. It is seriously demoralizing to do a ps and see
>> > 7011827128432950176177290 staring back at you. :)
>>
>> Well, doing cat /var/something/foo.pid, and seeing pid of unrelated process
>> is wrong, too... especially if you try to kill it....
>
> Good point. However the foo.pid scheme is incompatible with
> checkpoint/restart and migration regardless.
Well if you look at the other uses vserver and bsd style jail
mechanisms the concept is not nearly so ridiculous.
The funny thing though is that this is a trivial thing to continue
to make be sensible. Run the process in a chroot or a private
namespace and the /var/something/foo.pid works fine.
>
> So if you wanted to checkpoint and restart/migrate a process with a
> foo.pid type of file, you might need to start it with a private
> tmpfs in a private namespace. That part is trivial to do as part
> of the management tools, though checkpointing a whole tmpfs per process
> could be unfortunate.
The way you describe it I bet that tmpfs will likely be a small
fraction of the size of the processes that you are thinking
about checkpointing.
Eric
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-19 23:30 ` Pavel Machek
2005-11-20 22:38 ` Serge E. Hallyn
@ 2005-11-20 23:29 ` Nix
1 sibling, 0 replies; 86+ messages in thread
From: Nix @ 2005-11-20 23:29 UTC (permalink / raw)
To: Pavel Machek
Cc: Dave Hansen, Kyle Moffett, SERGE E. HALLYN [imap], Paul Jackson,
Linux Kernel Mailing List, frankeh
On 20 Nov 2005, Pavel Machek stated:
> Hi!
>> I also hate bloating types and making them sparse just for the hell of
>> it. It is seriously demoralizing to do a ps and see
>> 7011827128432950176177290 staring back at you. :)
>
> Well, doing cat /var/something/foo.pid, and seeing pid of unrelated process
> is wrong, too... especially if you try to kill it....
I'd venture to say that anything using multiple pid namespaces should be
mounting its own private /var/run subtree (and similar for other such
directories). Consider it as similar to the problem of colliding PIDs on
multiple physical hosts, or on a host and a pile of UMLs it's running:
the solution there, too, is to unshare /var/run (by not NFS-exporting it
in the latter two cases, by private mounts in the former).
(Isn't this PID namespace stuff meant for chroots anyway?)
--
`Y'know, London's nice at this time of year. If you like your cities
freezing cold and full of surly gits.' --- David Damerell
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-16 20:36 ` Pavel Machek
2005-11-16 20:48 ` Dave Hansen
@ 2005-11-16 21:07 ` Paul Jackson
1 sibling, 0 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-16 21:07 UTC (permalink / raw)
To: Pavel Machek; +Cc: mrmacman_g4, serue, linux-kernel, frankeh, haveblue
> Could we switch
> to 128-bits so that pids are never reused or something like that?
Not easily. We've got a very cool pid-dispenser at this point that
has excellent performance and scalability, but requires a bit map,
one bit per potential pid. That bitmap can't exceed a small percentage
of main memory on most any configuration, constraining us to perhaps
20 to 30 bits. The code currently has a 22 bit arbitrary limit.
Something like 30 bits would usually only make sense on the terabyte
NUMA monster boxes.
128-bit UUID technology scales fine, but adds quite a few compute
cycles per allocation, and would blow out a whole lot of user code
expecting to put a pid in a machine word.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-13 15:22 ` Pavel Machek
2005-11-16 19:36 ` Kyle Moffett
@ 2005-11-16 20:24 ` Dave Hansen
1 sibling, 0 replies; 86+ messages in thread
From: Dave Hansen @ 2005-11-16 20:24 UTC (permalink / raw)
To: Pavel Machek
Cc: SERGE E. HALLYN [imap], Paul Jackson, Linux Kernel Mailing List,
frankeh
On Sun, 2005-11-13 at 15:22 +0000, Pavel Machek wrote:
> > @@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)
> > if (unlikely(block_dump)) {
> > char b[BDEVNAME_SIZE];
> > printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
> > - current->comm, current->pid,
> > + current->comm, task_pid(current),
> > (rw & WRITE) ? "WRITE" : "READ",
> > (unsigned long long)bio->bi_sector,
> > bdevname(bio->bi_bdev,b));
>
> ...and now printk is close to useless, because uer can't know to which
> pidspace that pid belongs. Oops.
That is true, but only if we print the virtualized pid. Before we go
and actually implement the pid virtualization, we probably need a
thorough audit of this kind of stuff to see what we really want.
There will always be a "real pid" (the real thing in tsk->__pid) backing
whatever is virtualized and presented to getpid(). I would imagine that
this is the same that needs to go into dmesg.
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-14 23:36 ` [RFC] [PATCH 00/13] Introduce " Paul Jackson
2005-11-15 1:01 ` Serge E. Hallyn
2005-11-15 5:51 ` Serge E. Hallyn
@ 2005-11-15 13:34 ` Serge E. Hallyn
2 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 13:34 UTC (permalink / raw)
To: Paul Jackson; +Cc: linux-kernel, frankeh, haveblue
Quoting Paul Jackson (pj@sgi.com):
> Have you crosstool'd built this for most arch's? I could imagine
Thanks for this suggestion. I've now done this for s390, and see how
to set it up easily for all arches - this should be a tremendous help!
thanks,
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (13 preceding siblings ...)
2005-11-14 23:36 ` [RFC] [PATCH 00/13] Introduce " Paul Jackson
@ 2005-11-15 11:17 ` Robin Holt
2005-11-15 12:01 ` Dave Hansen
2005-11-15 19:21 ` Ray Bryant
2005-12-07 14:46 ` Eric W. Biederman
16 siblings, 1 reply; 86+ messages in thread
From: Robin Holt @ 2005-11-15 11:17 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, Hubertus Franke, Dave Hansen, hch
On Mon, Nov 14, 2005 at 03:23:41PM -0600, Serge E. Hallyn wrote:
> --
>
> I'm part of a project implementing checkpoint/restart processes.
> After a process or group of processes is checkpointed, killed, and
> restarted, the changing of pids could confuse them. There are many
> other such issues, but we wanted to start with pids.
Can't you just build a restart preloader which intercepts system calls
and translates pids? Wouldn't this keep the kernel simpler and only
affect those applications that are being restarted? Christoph, I
added you since you seem to tirelessly promote using preloaders to
work around this type of issue. Is it possible?
Thanks,
Robin
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 11:17 ` Robin Holt
@ 2005-11-15 12:01 ` Dave Hansen
0 siblings, 0 replies; 86+ messages in thread
From: Dave Hansen @ 2005-11-15 12:01 UTC (permalink / raw)
To: Robin Holt
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, hch
On Tue, 2005-11-15 at 05:17 -0600, Robin Holt wrote:
> Can't you just build a restart preloader which intercepts system calls
> and translates pids? Wouldn't this keep the kernel simpler and only
> affect those applications that are being restarted? Christoph, I
> added you since you seem to tirelessly promote using preloaders to
> work around this type of issue. Is it possible?
Statically linked applications really throw a pretty big monkey wrench
into that kind of plan. I'd hate to give up on _any_ statically linked
app from the beginning.
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (14 preceding siblings ...)
2005-11-15 11:17 ` Robin Holt
@ 2005-11-15 19:21 ` Ray Bryant
2005-11-15 19:41 ` Serge E. Hallyn
2005-12-07 14:46 ` Eric W. Biederman
16 siblings, 1 reply; 86+ messages in thread
From: Ray Bryant @ 2005-11-15 19:21 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, Hubertus Franke, Dave Hansen
On Monday 14 November 2005 15:23, Serge E. Hallyn wrote:
> --
>
> I'm part of a project implementing checkpoint/restart processes.
> After a process or group of processes is checkpointed, killed, and
> restarted, the changing of pids could confuse them. There are many
> other such issues, but we wanted to start with pids.
>
I've read through the rest of this thread, but it seems to me that the real
problems are in the basic assumptions you are making that are driving the
rest of this effort and perhaps we should be examining those assumptions
instead of your patch.
For example, from what I've read (particularly Hubertus's post that the pid
could be in a register), I'm inferring that what you want to do is to be able
to checkpoint/restart an arbitrary process at an arbitrary time and without
any special support for checkpoint/restart in that process.
Also (c. f. Dave Hansen's post on the number of Xen virtual machines
required), you appear to think that the number of processes on the system
for which checkpoint/restart should be enabled is large (more or less the
same as the number of processes on the system).
Am I reading this correctly?
--
Ray Bryant
AMD Performance Labs Austin, Tx
512-602-0038 (o) 512-507-7807 (c)
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 19:21 ` Ray Bryant
@ 2005-11-15 19:41 ` Serge E. Hallyn
2005-11-15 20:30 ` Ray Bryant
0 siblings, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 19:41 UTC (permalink / raw)
To: Ray Bryant; +Cc: Serge E. Hallyn, linux-kernel, Hubertus Franke, Dave Hansen
Quoting Ray Bryant (raybry@mpdtxmail.amd.com):
> On Monday 14 November 2005 15:23, Serge E. Hallyn wrote:
> > --
> >
> > I'm part of a project implementing checkpoint/restart processes.
> > After a process or group of processes is checkpointed, killed, and
> > restarted, the changing of pids could confuse them. There are many
> > other such issues, but we wanted to start with pids.
> >
>
> I've read through the rest of this thread, but it seems to me that the real
> problems are in the basic assumptions you are making that are driving the
> rest of this effort and perhaps we should be examining those assumptions
> instead of your patch.
Ok.
> For example, from what I've read (particularly Hubertus's post that the pid
> could be in a register), I'm inferring that what you want to do is to be able
> to checkpoint/restart an arbitrary process at an arbitrary time and without
> any special support for checkpoint/restart in that process.
Yes.
> Also (c. f. Dave Hansen's post on the number of Xen virtual machines
> required), you appear to think that the number of processes on the system
> for which checkpoint/restart should be enabled is large (more or less the
> same as the number of processes on the system).
Right.
> Am I reading this correctly?
As far as I can see, yes.
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 19:41 ` Serge E. Hallyn
@ 2005-11-15 20:30 ` Ray Bryant
2005-11-15 21:05 ` Serge E. Hallyn
2005-11-15 22:55 ` Cedric Le Goater
0 siblings, 2 replies; 86+ messages in thread
From: Ray Bryant @ 2005-11-15 20:30 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, Hubertus Franke, Dave Hansen
On Tuesday 15 November 2005 13:41, Serge E. Hallyn wrote:
> Quoting Ray Bryant (raybry@mpdtxmail.amd.com):
> > On Monday 14 November 2005 15:23, Serge E. Hallyn wrote:
> > > --
> > >
> > > I'm part of a project implementing checkpoint/restart processes.
> > > After a process or group of processes is checkpointed, killed, and
> > > restarted, the changing of pids could confuse them. There are many
> > > other such issues, but we wanted to start with pids.
> >
> > I've read through the rest of this thread, but it seems to me that the
> > real problems are in the basic assumptions you are making that are
> > driving the rest of this effort and perhaps we should be examining those
> > assumptions instead of your patch.
>
> Ok.
>
> > For example, from what I've read (particularly Hubertus's post that the
> > pid could be in a register), I'm inferring that what you want to do is to
> > be able to checkpoint/restart an arbitrary process at an arbitrary time
> > and without any special support for checkpoint/restart in that process.
>
> Yes.
>
> > Also (c. f. Dave Hansen's post on the number of Xen virtual machines
> > required), you appear to think that the number of processes on the
> > system for which checkpoint/restart should be enabled is large (more or
> > less the same as the number of processes on the system).
>
> Right.
>
> > Am I reading this correctly?
>
> As far as I can see, yes.
>
> -serge
Personally, I think that these assumptions are incorrect for a
checkpoint/restart facility. I think that:
(1) It is really only possible to checkpoint/restart a cooperative process.
For this to work with uncooperative processes you have to figure out (for
example) how to save and restore the file system state. (e. g. how do you
get the file position set correctly for an open file in the restored program
instance?) And this doesn't even consider what to do with open network
connections.
Similarly, what does one do about the content of System V shared memory
regions or the contents of System V semaphores? I'm sure there are many
more such problems we can come up with a careful study of the Linux/Unix API.
(Note that "cooperation" in this context can also mean "willing to run inside
of a container of some kind that supports checkpoint/restart".)
So you can probably only checkpoint the process at certain points in its
lifetime, points which the application should be willing to identify in some
way. And I would argue that at such points in time, you can require that
the current register state doesn't include the results of a system call such
as getpid(), couldn't you?
(2) Checkpoint/Restart really only makes sense for a long running, resource
intensive job. (e. g. for a job that is doing a lot of work and hence, for
which, recovery is hard -- perhaps as hard as re-running the entire job).
By their very nature, there are probably only a few such jobs running on the
system. If there are lots of such jobs on the system, then re-running each
one can't be that hard, can it?
So, I guess my question is wrt the task_pid API is the following: Given that
there are a lot of other problems to solve before transparent checkpointing
of uncooperative processes is possible, why should this partial solution be
accepted into the main line kernel and "set in stone" so to speak?
Don't get me wrong, I would love for there to be a commonly accepted
checkpoint/restart API. But I don't think that this can be done
transparently at the kernel level and without some cooperation from the
target task.
--
Ray Bryant
AMD Performance Labs Austin, Tx
512-602-0038 (o) 512-507-7807 (c)
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 20:30 ` Ray Bryant
@ 2005-11-15 21:05 ` Serge E. Hallyn
2005-11-15 22:43 ` Paul Jackson
2005-11-15 22:55 ` Cedric Le Goater
1 sibling, 1 reply; 86+ messages in thread
From: Serge E. Hallyn @ 2005-11-15 21:05 UTC (permalink / raw)
To: Ray Bryant; +Cc: Serge E. Hallyn, linux-kernel, Hubertus Franke, Dave Hansen
Quoting Ray Bryant (raybry@mpdtxmail.amd.com):
> On Tuesday 15 November 2005 13:41, Serge E. Hallyn wrote:
> > Quoting Ray Bryant (raybry@mpdtxmail.amd.com):
> > > On Monday 14 November 2005 15:23, Serge E. Hallyn wrote:
> > > > --
> > > >
> > > > I'm part of a project implementing checkpoint/restart processes.
> > > > After a process or group of processes is checkpointed, killed, and
> > > > restarted, the changing of pids could confuse them. There are many
> > > > other such issues, but we wanted to start with pids.
> > >
> > > I've read through the rest of this thread, but it seems to me that the
> > > real problems are in the basic assumptions you are making that are
> > > driving the rest of this effort and perhaps we should be examining those
> > > assumptions instead of your patch.
> >
> > Ok.
> >
> > > For example, from what I've read (particularly Hubertus's post that the
> > > pid could be in a register), I'm inferring that what you want to do is to
> > > be able to checkpoint/restart an arbitrary process at an arbitrary time
> > > and without any special support for checkpoint/restart in that process.
> >
> > Yes.
> >
> > > Also (c. f. Dave Hansen's post on the number of Xen virtual machines
> > > required), you appear to think that the number of processes on the
> > > system for which checkpoint/restart should be enabled is large (more or
> > > less the same as the number of processes on the system).
> >
> > Right.
> >
> > > Am I reading this correctly?
> >
> > As far as I can see, yes.
> >
> > -serge
>
> Personally, I think that these assumptions are incorrect for a
> checkpoint/restart facility. I think that:
>
> (1) It is really only possible to checkpoint/restart a cooperative process.
> For this to work with uncooperative processes you have to figure out (for
> example) how to save and restore the file system state. (e. g. how do you
> get the file position set correctly for an open file in the restored program
> instance?) And this doesn't even consider what to do with open network
> connections.
Many of these problems have been solved before. See for instance Zap
and ckpt (www.cs.wisc.edu/~zandy/ckpt), and more examples at
http://www.checkpointing.org/
Certainly there are pieces of state which are harder to correclty
restore than others, but even network connections have been shown to be
migrateable (see zap, and tpccp for cryopid). In fact IIUC one of the
hardest things to deal with are ttys.
> Similarly, what does one do about the content of System V shared memory
> regions or the contents of System V semaphores? I'm sure there are many
> more such problems we can come up with a careful study of the Linux/Unix API.
Yup, sysv shmem has been handled before... And yes, there are plenty
more :) /proc files, device files, pipes...
> (Note that "cooperation" in this context can also mean "willing to run inside
> of a container of some kind that supports checkpoint/restart".)
>
> So you can probably only checkpoint the process at certain points in its
> lifetime, points which the application should be willing to identify in some
This has been demonstrated to be not true. Again, see ckpt for a simple
example.
Oh, right, well willingness to run inside of a container *is* something we
would require :) Not needed for checkpointing a single process,
however - see ckpt.
> So, I guess my question is wrt the task_pid API is the following: Given that
> there are a lot of other problems to solve before transparent checkpointing
> of uncooperative processes is possible, why should this partial solution be
> accepted into the main line kernel and "set in stone" so to speak?
It shouldn't. This was a request for comment, not for inclusion :) As
you say there are lots of pieces to put together, and we simply decided
to start with trying to solve this one.
In fact what I sent out doesn't even do the stuff we've been talking
about lately - that will come later this week. This patchset merely lays
the groundwork for that.
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 21:05 ` Serge E. Hallyn
@ 2005-11-15 22:43 ` Paul Jackson
0 siblings, 0 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-15 22:43 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: raybry, serue, linux-kernel, frankeh, haveblue
> This has been demonstrated to be not true. Again, see ckpt for a simple
> example.
>
> Oh, right, well willingness to run inside of a container *is* something we
> would require :) Not needed for checkpointing a single process,
> however - see ckpt.
Be careful not to assume that some set of requirements on our result
is an appropriate set because, for each requirement, someone else has
demonstrated a solution that meets that requirement.
Sometimes there are tradeoffs. For example, ckpt will checkpoint/restart
a single task without kernel support, but doesn't preserve (from its README
at http://www.cs.wisc.edu/~zandy/ckpt/README):
- File descriptors of open files, special devices,
pipes, and sockets;
- Interprocess communication state (such as shared memory, semaphores,
mutex, messages);
- Kernel-level thread state;
- Process identifiers, including process id, process group;
id, user id, or group id.
and doesn't work with static bound programs (uses PRELOAD).
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 20:30 ` Ray Bryant
2005-11-15 21:05 ` Serge E. Hallyn
@ 2005-11-15 22:55 ` Cedric Le Goater
2005-11-16 1:12 ` Paul Jackson
1 sibling, 1 reply; 86+ messages in thread
From: Cedric Le Goater @ 2005-11-15 22:55 UTC (permalink / raw)
To: Ray Bryant; +Cc: Serge E. Hallyn, linux-kernel, Hubertus Franke, Dave Hansen
Ray Bryant wrote:
> Personally, I think that these assumptions are incorrect for a
> checkpoint/restart facility. I think that:
>
> (1) It is really only possible to checkpoint/restart a cooperative process.
What do you mean by cooperative ? that the code should be modified to
cooperate with a checkpoint/restart tool ? do you have something else in mind ?
> For this to work with uncooperative processes you have to figure out (for
> example) how to save and restore the file system state.
Files are definitely very difficult to handle efficiently but there are
ways to deal with them. One way is not to deal with them at all and let the
application organize its data in such a way that we don't have to
checkpoint the file system, share storage is one solution, copying files
from a checkpointed node to another node is an other. It can be very
inefficient but it works.
But, I agree with you, we don't want to checkpoint a filesystem.
> (e. g. how do you get the file position set correctly for an open file in
> the restored program instance?)
well, if the file is available, lseek() should do the job. Pipes are more
difficult to handle than regular files in fact.
> And this doesn't even consider what to do with open network connections.
network connections are indeed very tricky. The network code is very
complex, very large, plenty of protocols to handle but it can be done for
TCP/IP by blocking the traffic, checkpointing the data and checkpointing
the PCBs. But tell me more, what are the main issues for you ?
Private interconnect are a challenge.
> Similarly, what does one do about the content of System V shared memory
> regions or the contents of System V semaphores?
Well, they have to be constrained in a known set of processes, or a
container, to make sure we are not checkpointing a moving target.
> I'm sure there are many more such problems we can come up with a careful
> study of the Linux/Unix API.
Oh yes, the UNIX API is very large but in checkpoint/restart we care more
about implementation. This can be tricky.
> (Note that "cooperation" in this context can also mean "willing to run inside
> of a container of some kind that supports checkpoint/restart".)
Indeed !
We need an isolation mecanism to make sure we control the boundaries of an
application. We don't want any leaks when we initiate a checkpoint.
> So you can probably only checkpoint the process at certain points in its
> lifetime, points which the application should be willing to identify in some
> way.
We do need to reach a quiescience point. a SIGSTOP is enough or a container
wide schedule(), a la software suspend. But no more.
> And I would argue that at such points in time, you can require that
> the current register state doesn't include the results of a system call such
> as getpid(), couldn't you?
Well, what if that register holds a virtualized pid, this is no more an
issue, nop ?
> (2) Checkpoint/Restart really only makes sense for a long running, resource
> intensive job. (e. g. for a job that is doing a lot of work and hence, for
> which, recovery is hard -- perhaps as hard as re-running the entire job).
HPC industry is indeed an obvious target.
However, we have successfully checkpinted desktop applications like
openoffice, thunderbird, mozilla, emacs, etc. We are still working on pty
in order to migrate terminals. We think in can also be useful in that area
and others.
> By their very nature, there are probably only a few such jobs running on the
> system. If there are lots of such jobs on the system, then re-running each
> one can't be that hard, can it?
hmm, didn't get your point here ? can you elaborate ?
> So, I guess my question is wrt the task_pid API is the following: Given that
> there are a lot of other problems to solve before transparent checkpointing
> of uncooperative processes is possible, why should this partial solution be
> accepted into the main line kernel and "set in stone" so to speak?
Well, let's say that we want to present this one step after the other and
try to have each step brings some interesting value to the linux kernel.
Process aggregation is the first big step, other projects have shown
interest in this area, PAGG for instance. Isolation is another. The
virtualization step could be thought as dedicated to checkpoint/restart but
we're pretty sure it should help some projects like vserser that need to
virtualize some ancestor pid. On that subject, having a way to manage
cluster wide pids could be useful to HPC batch managers.
> Don't get me wrong, I would love for there to be a commonly accepted
> checkpoint/restart API. But I don't think that this can be done
> transparently at the kernel level and without some cooperation from the
> target task.
Well, we've already migrated some pretty ugly applications, database
engines, without modifying them :)
C.
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-15 22:55 ` Cedric Le Goater
@ 2005-11-16 1:12 ` Paul Jackson
0 siblings, 0 replies; 86+ messages in thread
From: Paul Jackson @ 2005-11-16 1:12 UTC (permalink / raw)
To: Cedric Le Goater; +Cc: raybry, serue, linux-kernel, frankeh, haveblue
Cedric wrote:
> Well, we've already migrated some pretty ugly applications, database
> engines, without modifying them :)
You will have to teach us how it is done.
As you likely know by now, Linux doesn't incorporate new technology
en mass. We sniff and poke at it, break it down into its constituent
elements and reconstitute it in ways that seem to fit Linux better.
It's all part of how we keep the body Linux healthy.
Especially for things like this that touch many of the more interesting
kernel constructs, the end result seldom resembles the initial input.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-11-14 21:23 [RFC] [PATCH 00/13] Introduce task_pid api Serge E. Hallyn
` (15 preceding siblings ...)
2005-11-15 19:21 ` Ray Bryant
@ 2005-12-07 14:46 ` Eric W. Biederman
2005-12-07 17:47 ` Dave Hansen
16 siblings, 1 reply; 86+ messages in thread
From: Eric W. Biederman @ 2005-12-07 14:46 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: linux-kernel, Hubertus Franke, Dave Hansen, Paul Jackson
"Serge E. Hallyn" <serue@us.ibm.com> writes:
> --
>
> I'm part of a project implementing checkpoint/restart processes.
> After a process or group of processes is checkpointed, killed, and
> restarted, the changing of pids could confuse them. There are many
> other such issues, but we wanted to start with pids.
>
> Does something like this, presumably after much working over, seem
> mergeable?
This set of patches looks like a global s/current->pid/task_pid(current)/
Which may be an interesting exercise but I don't see how this
helps your problem. And as has been shown by a few comments
this process making all of these changes is subject to human error.
Many of the interesting places that deal with pids and where you
want translation are not where the values are read from current->pid,
but where the values are passed between functions. Think about
the return value of do_fork.
There are also a lot of cases you haven't even tried to address.
You haven't touched process groups, or sessions.
At the current time the patch definitely fails the no in kernel
users test because it doesn't go as far as taking advantage
of the abstraction it attempts to introduce. Which means
other people can't read through the code and make sense
of what you are trying to do or to see if there is a better way.
I will also contend that walking down a path that does not cause
compilation to fail when the subtle things like which flavor of
pid you want to see is a problem.
Another question is how do your pid spaces nest. Currently
it sounds like you are taking the vserver model and allowing
everyone outside your pid space to see all of your internal
pids. Is this really what you want? Who do you report as
the source of your signal.
What pid does waitpid return when the parent of your pidspace exits?
What pid does waitpid return when both processes are in the same pidspace?
How does /proc handle multiple pid spaces?
While something allowing multiple pidspaces may be mergeable,
unnecessary and incomplete changes rarely are. This is a fundamental
change to the unix API so it will take a lot of scrutiny to get
merged.
Eric
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 14:46 ` Eric W. Biederman
@ 2005-12-07 17:47 ` Dave Hansen
2005-12-07 17:55 ` Arjan van de Ven
2005-12-07 19:19 ` Eric W. Biederman
0 siblings, 2 replies; 86+ messages in thread
From: Dave Hansen @ 2005-12-07 17:47 UTC (permalink / raw)
To: Eric W. Biederman
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
On Wed, 2005-12-07 at 07:46 -0700, Eric W. Biederman wrote:
> This set of patches looks like a global s/current->pid/task_pid(current)/
> Which may be an interesting exercise but I don't see how this
> helps your problem. And as has been shown by a few comments
> this process making all of these changes is subject to human error.
As with any good set of kernel changes, this is step one. Step two will
include calling something _other_ than task_pid(). But, in the
interests of small, incremental changes, this is what we decided to do
first.
> Many of the interesting places that deal with pids and where you
> want translation are not where the values are read from current->pid,
> but where the values are passed between functions. Think about
> the return value of do_fork.
Exactly. The next phase will focus on such places. Hubertus has some
stuff working that's probably not ready for LKML, but could certainly be
shared.
> There are also a lot of cases you haven't even tried to address.
> You haven't touched process groups, or sessions.
I preferred to keep the number of patches at 13, rather than 130. Those
are in the pipeline, but pids are the most important first step which
gets the most functionality.
> At the current time the patch definitely fails the no in kernel
> users test because it doesn't go as far as taking advantage
> of the abstraction it attempts to introduce. Which means
> other people can't read through the code and make sense
> of what you are trying to do or to see if there is a better way.
This isn't excatly a new feature, nor does it add any appreciable code
or complexity. I'm not sure that test even applies.
> I will also contend that walking down a path that does not cause
> compilation to fail when the subtle things like which flavor of
> pid you want to see is a problem.
I agree. I'm trying to figure out which way is best to go about this.
I have the feeling that using sparse tags like __user and __kernel is
the way to go, but we might also want to take the embedded struct
approach like atomic_t.
> Another question is how do your pid spaces nest.
They don't, and thankfully there is anybody asking for it. It adds
loads of complexity, and nobody apparently needs it.
> Currently
> it sounds like you are taking the vserver model and allowing
> everyone outside your pid space to see all of your internal
> pids. Is this really what you want?
For our application, yes. For vserver, maybe not. We'd like things
like 'top' to still work like normal, even though there are processes in
their own pidspace around.
> Who do you report as the source of your signal.
I've never dealt with signal enough from userspace to give you a good
answer. Can you explain the mechanics of how you would go about doing
this?
> What pid does waitpid return when the parent of your pidspace exits?
> What pid does waitpid return when both processes are in the same pidspace?
The pids coming out of system calls are always in the context of the
process doing the call.
> How does /proc handle multiple pid spaces?
I'm working on it :)
Right now, there's basically a hack in d_hash() to get new dentries for
each pidspace. It is horrible and causes a 50x decrease in performance
on some benchmarks like dbench.
I think the long-term solution is to make multiple, independent proc
mounts, and give each pidspace a separate filesystem view. That
requires some of the nifty new bind mount functionality and a chroot
when a new pidspace is created, but I think it works.
> While something allowing multiple pidspaces may be mergeable,
> unnecessary and incomplete changes rarely are. This is a fundamental
> change to the unix API so it will take a lot of scrutiny to get
> merged.
Lots of good questions. I think we need to take some of our initial,
private discussions and get them out on an open list somewhere. Any
suggestions? I hate creating new sourceforge projects :)
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 17:47 ` Dave Hansen
@ 2005-12-07 17:55 ` Arjan van de Ven
2005-12-07 18:09 ` Dave Hansen
2005-12-07 19:19 ` Eric W. Biederman
1 sibling, 1 reply; 86+ messages in thread
From: Arjan van de Ven @ 2005-12-07 17:55 UTC (permalink / raw)
To: Dave Hansen
Cc: Eric W. Biederman, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
> > Many of the interesting places that deal with pids and where you
> > want translation are not where the values are read from current->pid,
> > but where the values are passed between functions. Think about
> > the return value of do_fork.
>
> Exactly. The next phase will focus on such places. Hubertus has some
> stuff working that's probably not ready for LKML, but could certainly be
> shared.
>
hmm wonder if it's not just a lot simpler to introduce a split in
"kernel pid" and "userspace pid", and have current->pid and
current->user_pid for that.
Using accessor macros doesn't sound like it gains much here.. (but then
I've not seen the full picture and you have)
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 17:55 ` Arjan van de Ven
@ 2005-12-07 18:09 ` Dave Hansen
2005-12-07 19:00 ` Arjan van de Ven
0 siblings, 1 reply; 86+ messages in thread
From: Dave Hansen @ 2005-12-07 18:09 UTC (permalink / raw)
To: Arjan van de Ven
Cc: Eric W. Biederman, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
On Wed, 2005-12-07 at 18:55 +0100, Arjan van de Ven wrote:
> > > Many of the interesting places that deal with pids and where you
> > > want translation are not where the values are read from current->pid,
> > > but where the values are passed between functions. Think about
> > > the return value of do_fork.
> >
> > Exactly. The next phase will focus on such places. Hubertus has some
> > stuff working that's probably not ready for LKML, but could certainly be
> > shared.
>
> hmm wonder if it's not just a lot simpler to introduce a split in
> "kernel pid" and "userspace pid", and have current->pid and
> current->user_pid for that.
>
> Using accessor macros doesn't sound like it gains much here.. (but then
> I've not seen the full picture and you have)
My first instinct was to introduce functions like get_user_pid() and
get_kernel_pid() which would effectively introduce the same split.
Doing that, we could keep from even referencing ->user_pid in normal
code, and keep things small and simpler for people like the embedded
folks.
For the particular application that we're thinking of, we really don't
want "user pid" and "kernel pid" we want "virtualized" and
"unvirtualized", or "regular old pid" and "fancy new virtualized pid".
So, like in the global pidspace (which can see all pids and appears to
applications to be just like normal) you end up returning "kernel" pids
to userspace. That didn't seem to make sense.
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 18:09 ` Dave Hansen
@ 2005-12-07 19:00 ` Arjan van de Ven
2005-12-07 19:42 ` Eric W. Biederman
2005-12-07 22:13 ` Dave Hansen
0 siblings, 2 replies; 86+ messages in thread
From: Arjan van de Ven @ 2005-12-07 19:00 UTC (permalink / raw)
To: Dave Hansen
Cc: Eric W. Biederman, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
> > hmm wonder if it's not just a lot simpler to introduce a split in
> > "kernel pid" and "userspace pid", and have current->pid and
> > current->user_pid for that.
> >
> > Using accessor macros doesn't sound like it gains much here.. (but then
> > I've not seen the full picture and you have)
>
> My first instinct was to introduce functions like get_user_pid() and
> get_kernel_pid() which would effectively introduce the same split.
> Doing that, we could keep from even referencing ->user_pid in normal
> code, and keep things small and simpler for people like the embedded
> folks.
well I don't see the point for the abstraction... get_kernel_pid() is no
better or worse than using current->pid directly, unless you want to do
"deep magic".
> For the particular application that we're thinking of, we really don't
> want "user pid" and "kernel pid" we want "virtualized" and
> "unvirtualized", or "regular old pid" and "fancy new virtualized pid".
same thing, different name :)
> So, like in the global pidspace (which can see all pids and appears to
> applications to be just like normal) you end up returning "kernel" pids
> to userspace. That didn't seem to make sense.
hmm this is scary. If you don't have "unique" pids inside the kernel a
lot of stuff will subtly break. DRM for example (which has the pid
inside locking to track ownership and recursion), but I'm sure there's
many many cases like that. I guess the address of the task struct is the
ultimate unique pid in this sense.... but I suspect the way to get there
is first make a ->user_pid field, and switch all userspace visible stuff
to that, and then try to get rid of ->pid users one by one by
eliminating their uses...
but I'm really afraid that if you make the "fake" pid visible to normal
kernel code, too much stuff will go bonkers and end up with an eternal
stream of security hazards. "Magic" hurts here, and if you don't do
magic I don't see a reason to add an abstraction which in itself doesn't
mean anything or doesn't abstract anything....
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 19:00 ` Arjan van de Ven
@ 2005-12-07 19:42 ` Eric W. Biederman
2005-12-07 22:13 ` Dave Hansen
1 sibling, 0 replies; 86+ messages in thread
From: Eric W. Biederman @ 2005-12-07 19:42 UTC (permalink / raw)
To: Arjan van de Ven
Cc: Dave Hansen, SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
Arjan van de Ven <arjan@infradead.org> writes:
>> So, like in the global pidspace (which can see all pids and appears to
>> applications to be just like normal) you end up returning "kernel" pids
>> to userspace. That didn't seem to make sense.
>
> hmm this is scary. If you don't have "unique" pids inside the kernel a
> lot of stuff will subtly break. DRM for example (which has the pid
> inside locking to track ownership and recursion), but I'm sure there's
> many many cases like that. I guess the address of the task struct is the
> ultimate unique pid in this sense.... but I suspect the way to get there
> is first make a ->user_pid field, and switch all userspace visible stuff
> to that, and then try to get rid of ->pid users one by one by
> eliminating their uses...
>
> but I'm really afraid that if you make the "fake" pid visible to normal
> kernel code, too much stuff will go bonkers and end up with an eternal
> stream of security hazards. "Magic" hurts here, and if you don't do
> magic I don't see a reason to add an abstraction which in itself doesn't
> mean anything or doesn't abstract anything....
Thanks, you said that better that I did :)
Eric
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 19:00 ` Arjan van de Ven
2005-12-07 19:42 ` Eric W. Biederman
@ 2005-12-07 22:13 ` Dave Hansen
2005-12-07 22:20 ` Arjan van de Ven
1 sibling, 1 reply; 86+ messages in thread
From: Dave Hansen @ 2005-12-07 22:13 UTC (permalink / raw)
To: Arjan van de Ven
Cc: Eric W. Biederman, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
On Wed, 2005-12-07 at 20:00 +0100, Arjan van de Ven wrote:
> > So, like in the global pidspace (which can see all pids and appears to
> > applications to be just like normal) you end up returning "kernel" pids
> > to userspace. That didn't seem to make sense.
>
> hmm this is scary. If you don't have "unique" pids inside the kernel a
> lot of stuff will subtly break. DRM for example (which has the pid
> inside locking to track ownership and recursion), but I'm sure there's
> many many cases like that. I guess the address of the task struct is the
> ultimate unique pid in this sense.... but I suspect the way to get there
> is first make a ->user_pid field, and switch all userspace visible stuff
> to that, and then try to get rid of ->pid users one by one by
> eliminating their uses...
OK, what I'm talking about here is the way that it is done now with
existing code. It seems to work and make people happy, but it certainly
isn't the only possible way to do it. I'm very open to suggestions. :)
There really are two distinct pid spaces. Instead of vservers, we tend
to call the different partitioned areas containers.
Each container can only see processes in its own container. The
exception is the "global container", which has a view of all of the
system processes. Having the global container allows you to do things
like see all of the processes on the whole system with top.
So, the current tsk->pid is still unique. However, there is also a
tsk->virtual_pid (or some name) that is unique _inside_ of a container.
These two pids are completely unrelated. Having this virtualized pid
allows you to have the real tsk->pid change without userspace ever
knowing.
For example, that tsk->pid might change if you checkpointed a process,
it crashed, and you restarted it later from the checkpoint.
> but I'm really afraid that if you make the "fake" pid visible to normal
> kernel code, too much stuff will go bonkers and end up with an eternal
> stream of security hazards. "Magic" hurts here, and if you don't do
> magic I don't see a reason to add an abstraction which in itself doesn't
> mean anything or doesn't abstract anything....
99% of the time, the kernel can deal with the same old tsk->pid that
it's always dealt with. Generally, the only times the kernel has to
worry about the virtualized one is where (as Eric noted) it cross the
user<->kernel boundary.
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 22:13 ` Dave Hansen
@ 2005-12-07 22:20 ` Arjan van de Ven
2005-12-12 10:55 ` Dave Airlie
0 siblings, 1 reply; 86+ messages in thread
From: Arjan van de Ven @ 2005-12-07 22:20 UTC (permalink / raw)
To: Dave Hansen
Cc: Eric W. Biederman, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
> 99% of the time, the kernel can deal with the same old tsk->pid that
> it's always dealt with. Generally, the only times the kernel has to
> worry about the virtualized one is where (as Eric noted) it cross the
> user<->kernel boundary.
that's fair enough. I don't see the need for the macro abstractions
though; a current->pid and current->user_pid (or visible_pid or any
other good name) split makes sense. no need for macro abstractions at
all, just add ->user_pid in patch 1, in patch 2 assign it default to
->pid as well and patch 3 converts the places where ->pid is now given
to userspace ;)
again the DRM layer needs an audit, I'm not entirely sure if it doesn't
get pids from userspace. THe rest of the kernel mostly ought to cope
just fine.
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 22:20 ` Arjan van de Ven
@ 2005-12-12 10:55 ` Dave Airlie
2005-12-19 14:04 ` Eric W. Biederman
0 siblings, 1 reply; 86+ messages in thread
From: Dave Airlie @ 2005-12-12 10:55 UTC (permalink / raw)
To: Arjan van de Ven
Cc: Dave Hansen, Eric W. Biederman, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
>
> again the DRM layer needs an audit, I'm not entirely sure if it doesn't
> get pids from userspace. THe rest of the kernel mostly ought to cope
> just fine.
>
Yes yet again, if you can think of it, the drm will have found a way
to do it :-)
the drmGetClient ioctl passes pids across the user/kernel boundary,
its the only place I can see in a quick look at the interfaces.... but
it isn't used for anything as far as I can see except for the dristat
testing utility..
Dave.
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-12 10:55 ` Dave Airlie
@ 2005-12-19 14:04 ` Eric W. Biederman
0 siblings, 0 replies; 86+ messages in thread
From: Eric W. Biederman @ 2005-12-19 14:04 UTC (permalink / raw)
To: Dave Airlie
Cc: Arjan van de Ven, Dave Hansen, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
Dave Airlie <airlied@gmail.com> writes:
>>
>> again the DRM layer needs an audit, I'm not entirely sure if it doesn't
>> get pids from userspace. THe rest of the kernel mostly ought to cope
>> just fine.
>>
>
> Yes yet again, if you can think of it, the drm will have found a way
> to do it :-)
>
> the drmGetClient ioctl passes pids across the user/kernel boundary,
> its the only place I can see in a quick look at the interfaces.... but
> it isn't used for anything as far as I can see except for the dristat
> testing utility..
There are crazier cases in the kernel. Netlink is my favorite example
it's default ports are the process pid and some locations in the kernel
even assume you are using the default port.
Eric
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 17:47 ` Dave Hansen
2005-12-07 17:55 ` Arjan van de Ven
@ 2005-12-07 19:19 ` Eric W. Biederman
2005-12-07 21:40 ` Dave Hansen
2005-12-07 22:17 ` Cedric Le Goater
1 sibling, 2 replies; 86+ messages in thread
From: Eric W. Biederman @ 2005-12-07 19:19 UTC (permalink / raw)
To: Dave Hansen
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
Dave Hansen <haveblue@us.ibm.com> writes:
> On Wed, 2005-12-07 at 07:46 -0700, Eric W. Biederman wrote:
>> There are also a lot of cases you haven't even tried to address.
>> You haven't touched process groups, or sessions.
>
> I preferred to keep the number of patches at 13, rather than 130. Those
> are in the pipeline, but pids are the most important first step which
> gets the most functionality.
Process groups are also pids, and there are direct relationships
between pids and process group ids and session ids. I agree keeping
the focus tight make sense but not so tight that you miss pieces.
>> At the current time the patch definitely fails the no in kernel
>> users test because it doesn't go as far as taking advantage
>> of the abstraction it attempts to introduce. Which means
>> other people can't read through the code and make sense
>> of what you are trying to do or to see if there is a better way.
>
> This isn't excatly a new feature, nor does it add any appreciable code
> or complexity. I'm not sure that test even applies.
A very common comment on the thread up to now is that people haven't
seen the big picture so they can't comment.
>> I will also contend that walking down a path that does not cause
>> compilation to fail when the subtle things like which flavor of
>> pid you want to see is a problem.
>
> I agree. I'm trying to figure out which way is best to go about this.
> I have the feeling that using sparse tags like __user and __kernel is
> the way to go, but we might also want to take the embedded struct
> approach like atomic_t.
You can also make the kernel functions that take a pidspace argument
and you will have instant compile failures :)
>> Another question is how do your pid spaces nest.
>
> They don't, and thankfully there is anybody asking for it. It adds
> loads of complexity, and nobody apparently needs it.
So only very special pids can generate a pidspace. That will
tend to reduce the generality of the solution. What do you do
if I am running your code in a vserver?
There enough possibilities to the solution space a few extra
constraints I think would help in this case.
>> Currently
>> it sounds like you are taking the vserver model and allowing
>> everyone outside your pid space to see all of your internal
>> pids. Is this really what you want?
>
> For our application, yes. For vserver, maybe not. We'd like things
> like 'top' to still work like normal, even though there are processes in
> their own pidspace around.
I can see the desire. But top is already strongly challenged if
you are talking hpc computing. It only works on one node. Anything
that teaches proc about multiple node mounts ought to work just
as well for an internal checkpoint restart implementation.
>> Who do you report as the source of your signal.
>
> I've never dealt with signal enough from userspace to give you a good
> answer. Can you explain the mechanics of how you would go about doing
> this?
Look at siginfo_t si_pid....
>> What pid does waitpid return when the parent of your pidspace exits?
>> What pid does waitpid return when both processes are in the same pidspace?
>
> The pids coming out of system calls are always in the context of the
> process doing the call.
This is of course the definition. But how you implement those cases
is interesting.
>> How does /proc handle multiple pid spaces?
>
> I'm working on it :)
>
> Right now, there's basically a hack in d_hash() to get new dentries for
> each pidspace. It is horrible and causes a 50x decrease in performance
> on some benchmarks like dbench.
>
> I think the long-term solution is to make multiple, independent proc
> mounts, and give each pidspace a separate filesystem view. That
> requires some of the nifty new bind mount functionality and a chroot
> when a new pidspace is created, but I think it works.
I think you will ultimately want a new filesystem namespace
not just a chroot, so you can ``virtualize'' your filesystem namespace
as well.
>> While something allowing multiple pidspaces may be mergeable,
>> unnecessary and incomplete changes rarely are. This is a fundamental
>> change to the unix API so it will take a lot of scrutiny to get
>> merged.
>
> Lots of good questions. I think we need to take some of our initial,
> private discussions and get them out on an open list somewhere. Any
> suggestions? I hate creating new sourceforge projects :)
I wonder if you could hook up with the linux vserver project. The
requirements are strongly similar, and making a solution that
would work for everyone has a better chance of getting in.
Eric
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 19:19 ` Eric W. Biederman
@ 2005-12-07 21:40 ` Dave Hansen
2005-12-07 22:17 ` Eric W. Biederman
2005-12-07 22:17 ` Cedric Le Goater
1 sibling, 1 reply; 86+ messages in thread
From: Dave Hansen @ 2005-12-07 21:40 UTC (permalink / raw)
To: Eric W. Biederman
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
On Wed, 2005-12-07 at 12:19 -0700, Eric W. Biederman wrote:
> Process groups are also pids, and there are direct relationships
> between pids and process group ids and session ids. I agree keeping
> the focus tight make sense but not so tight that you miss pieces.
There's a "reference implementation" that the kernel community hasn't
seen which is certainly not mergeable, but shows all of the pieces.
Personally, I really want to share it, and I hope that we can soon.
> >> At the current time the patch definitely fails the no in kernel
> >> users test because it doesn't go as far as taking advantage
> >> of the abstraction it attempts to introduce. Which means
> >> other people can't read through the code and make sense
> >> of what you are trying to do or to see if there is a better way.
> >
> > This isn't excatly a new feature, nor does it add any appreciable code
> > or complexity. I'm not sure that test even applies.
>
> A very common comment on the thread up to now is that people haven't
> seen the big picture so they can't comment.
Yup, this is a big issue. I think getting that "other code" out there
is part of filling you guys in. The other part is discussions like
this. :)
>From your comments, I can see that you have a much bigger piece of the
picture in your head than you think.
> >> Another question is how do your pid spaces nest.
> >
> > They don't, and thankfully there is anybody asking for it. It adds
> > loads of complexity, and nobody apparently needs it.
>
> So only very special pids can generate a pidspace. That will
> tend to reduce the generality of the solution. What do you do
> if I am running your code in a vserver?
I don't think it would be a good idea to stack these containers within
vservers, either. vserver uses different pidspaces, and will use the
same infrastructure. The only difference is that they only have a very
small change to the different pidspaces for init.
> >> Who do you report as the source of your signal.
> >
> > I've never dealt with signal enough from userspace to give you a good
> > answer. Can you explain the mechanics of how you would go about doing
> > this?
>
> Look at siginfo_t si_pid....
Are those things that are exported outside of the kernel? It's not
immediately obvious.
> >> While something allowing multiple pidspaces may be mergeable,
> >> unnecessary and incomplete changes rarely are. This is a fundamental
> >> change to the unix API so it will take a lot of scrutiny to get
> >> merged.
> >
> > Lots of good questions. I think we need to take some of our initial,
> > private discussions and get them out on an open list somewhere. Any
> > suggestions? I hate creating new sourceforge projects :)
>
> I wonder if you could hook up with the linux vserver project. The
> requirements are strongly similar, and making a solution that
> would work for everyone has a better chance of getting in.
Already hooked up. They need the same stuff we want, just in smaller
quantities. They can easily stack on top of whatever we do.
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 21:40 ` Dave Hansen
@ 2005-12-07 22:17 ` Eric W. Biederman
2004-12-14 15:23 ` Pavel Machek
2005-12-07 22:31 ` Dave Hansen
0 siblings, 2 replies; 86+ messages in thread
From: Eric W. Biederman @ 2005-12-07 22:17 UTC (permalink / raw)
To: Dave Hansen
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
Dave Hansen <haveblue@us.ibm.com> writes:
> On Wed, 2005-12-07 at 12:19 -0700, Eric W. Biederman wrote:
>> >> Another question is how do your pid spaces nest.
>> >
>> > They don't, and thankfully there is anybody asking for it. It adds
>> > loads of complexity, and nobody apparently needs it.
>>
>> So only very special pids can generate a pidspace. That will
>> tend to reduce the generality of the solution. What do you do
>> if I am running your code in a vserver?
>
> I don't think it would be a good idea to stack these containers within
> vservers, either. vserver uses different pidspaces, and will use the
> same infrastructure. The only difference is that they only have a very
> small change to the different pidspaces for init.
Well that depends on the implementation. The first concern with
the implementation is of course maintainability.
But beyond that a general test to see if you have done a good
job of virtualizing something is to see if you can recurse.
One of my wish list items would be to run my things like my
web browser in a container with only access to a subset of
the things I can normally access. That way I could be less
concerned about the latest browser security bug.
Although I do expect that just like private namespaces it will
take a while to figure out how to allow non-privileged access
to these kinds of powerful concepts.
In the bsdjail paper the point is made that as systems grow
more complex creating minimal privilege containers is easy
and simple compared to what it takes to get a complex system
up and going today. (I expressed that badly)
And then of course there is the other pipe dream if you can
consider the whole system in a container then you can implement
the equivalent of swsuspend by checkpointing the top level
container.
At least this should solve the classic complaint about job
control. That it wasn't transparent to processes.
>> >> Who do you report as the source of your signal.
>> >
>> > I've never dealt with signal enough from userspace to give you a good
>> > answer. Can you explain the mechanics of how you would go about doing
>> > this?
>>
>> Look at siginfo_t si_pid....
>
> Are those things that are exported outside of the kernel? It's not
> immediately obvious.
Sorry do a man sigaction. Basically the signal handler
needs to be configured with SA_SIGINFO but it should get
that information.
I believe you have to
Eric
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 22:17 ` Eric W. Biederman
@ 2004-12-14 15:23 ` Pavel Machek
2005-12-14 13:40 ` Arjan van de Ven
2005-12-07 22:31 ` Dave Hansen
1 sibling, 1 reply; 86+ messages in thread
From: Pavel Machek @ 2004-12-14 15:23 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Dave Hansen, SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
Hi!
> One of my wish list items would be to run my things like my
> web browser in a container with only access to a subset of
> the things I can normally access. That way I could be less
> concerned about the latest browser security bug.
subterfugue.sf.net (using ptrace), but yes, nicer solution
would be welcome.
--
Thanks, Sharp!
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2004-12-14 15:23 ` Pavel Machek
@ 2005-12-14 13:40 ` Arjan van de Ven
2005-12-14 16:29 ` Serge E. Hallyn
0 siblings, 1 reply; 86+ messages in thread
From: Arjan van de Ven @ 2005-12-14 13:40 UTC (permalink / raw)
To: Pavel Machek
Cc: Eric W. Biederman, Dave Hansen, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
On Tue, 2004-12-14 at 15:23 +0000, Pavel Machek wrote:
> Hi!
>
> > One of my wish list items would be to run my things like my
> > web browser in a container with only access to a subset of
> > the things I can normally access. That way I could be less
> > concerned about the latest browser security bug.
>
> subterfugue.sf.net (using ptrace), but yes, nicer solution
> would be welcome.
selinux too, as well as andrea's syscall filter thing and many others.
the hardest is the balance between security and usability. You don't
want your browser to be able to read files in your home dir (Except
maybe a few selected ones in the browsers own dir)... until you want to
upload a file via a webform.
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-14 13:40 ` Arjan van de Ven
@ 2005-12-14 16:29 ` Serge E. Hallyn
0 siblings, 0 replies; 86+ messages in thread
From: Serge E. Hallyn @ 2005-12-14 16:29 UTC (permalink / raw)
To: Arjan van de Ven
Cc: Pavel Machek, Eric W. Biederman, Dave Hansen, SERGE E. HALLYN,
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
Quoting Arjan van de Ven (arjan@infradead.org):
> On Tue, 2004-12-14 at 15:23 +0000, Pavel Machek wrote:
> > Hi!
> >
> > > One of my wish list items would be to run my things like my
> > > web browser in a container with only access to a subset of
> > > the things I can normally access. That way I could be less
> > > concerned about the latest browser security bug.
> >
> > subterfugue.sf.net (using ptrace), but yes, nicer solution
> > would be welcome.
>
> selinux too, as well as andrea's syscall filter thing and many others.
>
> the hardest is the balance between security and usability. You don't
> want your browser to be able to read files in your home dir (Except
> maybe a few selected ones in the browsers own dir)... until you want to
> upload a file via a webform.
Yup, right now I use a separate account (not in wheel) for web browsing,
which using Janak's unshare() patch and a small pam library gets its own
namespace which can't see my dmcrypted home partition and has private
/tmp. File sharing is done through a non-standard tmp, just to prevent
scripts from using it.
Pretty convenient, but it really wants some stronger isolation. You'd
think I'd at least use my bsdjail to keep unix sockets and such safe...
Anyway, real containers would indeed be far more convenient, or at least
prettier.
-serge
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 22:17 ` Eric W. Biederman
2004-12-14 15:23 ` Pavel Machek
@ 2005-12-07 22:31 ` Dave Hansen
2005-12-07 22:51 ` Eric W. Biederman
` (2 more replies)
1 sibling, 3 replies; 86+ messages in thread
From: Dave Hansen @ 2005-12-07 22:31 UTC (permalink / raw)
To: Eric W. Biederman
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
On Wed, 2005-12-07 at 15:17 -0700, Eric W. Biederman wrote:
> But beyond that a general test to see if you have done a good
> job of virtualizing something is to see if you can recurse.
I admit it would be interesting at the very least. But, using that
definition, we haven't done any good virtualization in Linux that I can
think of. Besides some vague ranting I heard about zSeries (the real
IBM mainframes) I can't think of anything that does this today.
I don think any of Solaris containers, ppc64 LPARs, Xen, UML, or
vservers can recurse.
Can you think of any?
-- Dave
^ permalink raw reply [flat|nested] 86+ messages in thread* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 22:31 ` Dave Hansen
@ 2005-12-07 22:51 ` Eric W. Biederman
2005-12-08 5:42 ` Jeff Dike
2005-12-08 10:09 ` Andi Kleen
2 siblings, 0 replies; 86+ messages in thread
From: Eric W. Biederman @ 2005-12-07 22:51 UTC (permalink / raw)
To: Dave Hansen
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
Dave Hansen <haveblue@us.ibm.com> writes:
> On Wed, 2005-12-07 at 15:17 -0700, Eric W. Biederman wrote:
>> But beyond that a general test to see if you have done a good
>> job of virtualizing something is to see if you can recurse.
>
> I admit it would be interesting at the very least. But, using that
> definition, we haven't done any good virtualization in Linux that I can
> think of. Besides some vague ranting I heard about zSeries (the real
> IBM mainframes) I can't think of anything that does this today.
>
> I don think any of Solaris containers, ppc64 LPARs, Xen, UML, or
> vservers can recurse.
>
> Can you think of any?
There is Xnest that allows X to run on X.
There are process groups and sessions that while they may
not strictly nest you don't loose the ability to create new
ones.
There is the CLONE_NEWNS and just about any of the other
clone flags in linux.
There is bochs that emulates the whole machine.
I am actually a little surprised that UML can't run UML. I
suspect it is an address space conflict and not something fundamental.
With pidspaces as long as the parent isn't required to send
signals to arbitrary children I don't think nesting pids spaces
is hard. Or more properly have a process in one pidspace be
the parent of a process in another. Although I grant there
are a few boundary issues, that have to be handled carefully.
Eric
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 22:31 ` Dave Hansen
2005-12-07 22:51 ` Eric W. Biederman
@ 2005-12-08 5:42 ` Jeff Dike
2005-12-08 10:09 ` Andi Kleen
2 siblings, 0 replies; 86+ messages in thread
From: Jeff Dike @ 2005-12-08 5:42 UTC (permalink / raw)
To: Dave Hansen
Cc: Eric W. Biederman, SERGE E. HALLYN [imap],
Linux Kernel Mailing List, Hubertus Franke, Paul Jackson
On Wed, Dec 07, 2005 at 02:31:25PM -0800, Dave Hansen wrote:
> I don think any of Solaris containers, ppc64 LPARs, Xen, UML, or
> vservers can recurse.
UML can, but it's not a heavily exercised option, and it needs some fixes in
order to recurse in the currently favored mode of operation.
Jeff
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 22:31 ` Dave Hansen
2005-12-07 22:51 ` Eric W. Biederman
2005-12-08 5:42 ` Jeff Dike
@ 2005-12-08 10:09 ` Andi Kleen
2 siblings, 0 replies; 86+ messages in thread
From: Andi Kleen @ 2005-12-08 10:09 UTC (permalink / raw)
To: Dave Hansen
Cc: SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
Dave Hansen <haveblue@us.ibm.com> writes:
>
> Can you think of any?
qemu can afaik. I've also heard about simnow in qemu and
Xen in qemu, although that's not true recursion. And VMware/qemu/
simnow/UML/... will all probably run fine in Xen native guests.
I wouldn't be surprised if UML supported true recursion too.
But then for what do you really need recursion? It might be nice
theory, but in practice it's probably not too relevant. I guess it
was useful long ago for debugging VM itself when mainframes were
really expensive so you couldn't just buy a development machine and
test your VM on raw iron. But that's not really true today anymore.
Ok one weak reason to still use it might be if your test machine takes
too long to reboot. But then Hypervisor hackers are a pretty narrow
target group for features like this.
-Andi
^ permalink raw reply [flat|nested] 86+ messages in thread
* Re: [RFC] [PATCH 00/13] Introduce task_pid api
2005-12-07 19:19 ` Eric W. Biederman
2005-12-07 21:40 ` Dave Hansen
@ 2005-12-07 22:17 ` Cedric Le Goater
1 sibling, 0 replies; 86+ messages in thread
From: Cedric Le Goater @ 2005-12-07 22:17 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Dave Hansen, SERGE E. HALLYN [imap], Linux Kernel Mailing List,
Hubertus Franke, Paul Jackson
Eric W. Biederman wrote:
>>>Who do you report as the source of your signal.
>>
>>I've never dealt with signal enough from userspace to give you a good
>>answer. Can you explain the mechanics of how you would go about doing
>>this?
>
> Look at siginfo_t si_pid....
the siginfo is queued when a process is killed and si_pid is updated using
the pidspace of the killing process. Processes parent of a pidspace are of
a special kind : the init kind.
>>>What pid does waitpid return when the parent of your pidspace exits?
Well, a process doing waitpid on a parent of a pidspace, is not part
of that pidspace so waitpid would return the 'real pid'.
Am i getting your point correctly ?
>>>What pid does waitpid return when both processes are in the same pidspace?
hmm, please elaborate.
There are indeed issues when a process is the parent of different
namespaces. This case that should be avoided.
>>>How does /proc handle multiple pid spaces?
>>
>>I'm working on it :)
>>
>>Right now, there's basically a hack in d_hash() to get new dentries for
>>each pidspace. It is horrible and causes a 50x decrease in performance
>>on some benchmarks like dbench.
>>
>>I think the long-term solution is to make multiple, independent proc
>>mounts, and give each pidspace a separate filesystem view. That
>>requires some of the nifty new bind mount functionality and a chroot
>>when a new pidspace is created, but I think it works.
>
> I think you will ultimately want a new filesystem namespace
> not just a chroot, so you can ``virtualize'' your filesystem namespace
> as well.
"virtualize" the mount points but not necessarily the whole filesystem.
> I wonder if you could hook up with the linux vserver project. The
> requirements are strongly similar, and making a solution that
> would work for everyone has a better chance of getting in.
We feel the same.
C.
^ permalink raw reply [flat|nested] 86+ messages in thread