diff options
Diffstat (limited to 'fs/timerfd.c')
| -rw-r--r-- | fs/timerfd.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c index ab8dd1538381..147b72349d3b 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -44,6 +44,8 @@ struct timerfd_ctx { bool might_cancel; }; +static atomic_t instance_count = ATOMIC_INIT(0); + static LIST_HEAD(cancel_list); static DEFINE_SPINLOCK(cancel_lock); @@ -387,6 +389,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) { int ufd; struct timerfd_ctx *ctx; + char task_comm_buf[TASK_COMM_LEN]; + char file_name_buf[32]; + int instance; /* Check the TFD_* constants for consistency. */ BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); @@ -423,7 +428,12 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) ctx->moffs = ktime_mono_to_real((ktime_t){ .tv64 = 0 }); - ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, + instance = atomic_inc_return(&instance_count); + get_task_comm(task_comm_buf, current); + snprintf(file_name_buf, sizeof(file_name_buf), "[timerfd%d_%.*s]", + instance, (int)sizeof(task_comm_buf), task_comm_buf); + + ufd = anon_inode_getfd(file_name_buf, &timerfd_fops, ctx, O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS)); if (ufd < 0) kfree(ctx); |
