]> git.openpandora.org Git - sgx.git/commitdiff
gpu: pvr: get proc name during process attach time
authorImre Deak <imre.deak@nokia.com>
Fri, 1 Apr 2011 15:05:39 +0000 (18:05 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:05 +0000 (21:43 +0300)
This will be needed by the upcoming patches where we need a cheap way
to get to the current process name.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
pvr/osfunc.c
pvr/osfunc.h
pvr/perproc.c
pvr/perproc.h

index c3c36acf9a43e38fc9c1242fc2fdf1d6ec649edc..b14994c29faa065e6e445ed0628bf122e3b3ca7e 100644 (file)
@@ -1122,6 +1122,16 @@ enum PVRSRV_ERROR OSCopyFromUser(void *pvProcess, void *pvDest,
                return PVRSRV_ERROR_GENERIC;
 }
 
+void get_proc_name(int pid, char *buf, size_t buf_size)
+{
+       struct task_struct *tsk;
+
+       rcu_read_lock();
+       tsk = pid_task(find_vpid(pid), PIDTYPE_PID);
+       strlcpy(buf, tsk->comm, buf_size);
+       rcu_read_unlock();
+}
+
 IMG_BOOL OSAccessOK(enum IMG_VERIFY_TEST eVerification,
                    const void __user *pvUserPtr, u32 ui32Bytes)
 {
index 0419d4fa7fb553469087b59f9a83772d70272f6f..158034c4295533d52c21bbd30d77bfac7f48bad0 100644 (file)
@@ -216,4 +216,6 @@ enum PVRSRV_ERROR OSAcquirePhysPageAddr(void *pvCPUVAddr, u32 ui32Bytes,
                                        void **phOSWrapMem);
 enum PVRSRV_ERROR OSReleasePhysPageAddr(void *hOSWrapMem);
 
+void get_proc_name(int pid, char *buf, size_t buf_size);
+
 #endif
index d0d4f4cc806a31846a9e715efa3a17db65f3c393..1aae887138613f61c238c6218492dca5c5ec06a9 100644 (file)
@@ -134,6 +134,9 @@ enum PVRSRV_ERROR PVRSRVPerProcessDataConnect(u32 ui32PID)
                OSMemSet(psPerProc, 0, sizeof(*psPerProc));
                psPerProc->hBlockAlloc = hBlockAlloc;
 
+               get_proc_name(ui32PID, psPerProc->name,
+                             sizeof(psPerProc->name));
+
                if (!HASH_Insert(psHashTab, (u32) ui32PID, (u32)psPerProc)) {
                        PVR_DPF(PVR_DBG_ERROR, "PVRSRVPerProcessDataConnect: "
                           "Couldn't insert per-process data into hash table");
index a89b0e4e51ed95e5a3dd59109c3e0dd8aedf13ad..3a8810c3c3ef2eb430709b42036e068e5553692d 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef __PERPROC_H__
 #define __PERPROC_H__
 
+#include <linux/sched.h>
+
 #include "img_types.h"
 #include "resman.h"
 
@@ -34,6 +36,7 @@
 
 struct PVRSRV_PER_PROCESS_DATA {
        u32 ui32PID;
+       char name[TASK_COMM_LEN];
        void *hBlockAlloc;
        struct RESMAN_CONTEXT *hResManContext;
        void *hPerProcData;