mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	Kernel: Merge {get,set}_process_name syscalls to the prctl syscall
It makes much more sense to have these actions being performed via the prctl syscall, as they both require 2 plain arguments to be passed to the syscall layer, and in contrast to most syscalls, we don't get in these removed syscalls an automatic representation of Userspace<T>, but two FlatPtr(s) to perform casting on them in the prctl syscall which is suited to what has been done in the removed syscalls. Also, it makes sense to have these actions in the prctl syscall, because they are strongly related to the process control concept of the prctl syscall.
This commit is contained in:
		
							parent
							
								
									1e36d54493
								
							
						
					
					
						commit
						d16d805d96
					
				
					 9 changed files with 36 additions and 71 deletions
				
			
		|  | @ -23,33 +23,4 @@ ErrorOr<FlatPtr> Process::sys$getppid() | |||
|     return ppid().value(); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<FlatPtr> Process::sys$get_process_name(Userspace<char*> buffer, size_t buffer_size) | ||||
| { | ||||
|     VERIFY_NO_PROCESS_BIG_LOCK(this); | ||||
|     TRY(require_promise(Pledge::stdio)); | ||||
| 
 | ||||
|     TRY(m_name.with([&buffer, buffer_size](auto& name) -> ErrorOr<void> { | ||||
|         if (name->length() + 1 > buffer_size) | ||||
|             return ENAMETOOLONG; | ||||
| 
 | ||||
|         return copy_to_user(buffer, name->characters(), name->length() + 1); | ||||
|     })); | ||||
| 
 | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<FlatPtr> Process::sys$set_process_name(Userspace<char const*> user_name, size_t user_name_length) | ||||
| { | ||||
|     VERIFY_NO_PROCESS_BIG_LOCK(this); | ||||
|     TRY(require_promise(Pledge::proc)); | ||||
|     if (user_name_length > 256) | ||||
|         return ENAMETOOLONG; | ||||
|     auto name = TRY(try_copy_kstring_from_user(user_name, user_name_length)); | ||||
|     // Empty and whitespace-only names only exist to confuse users.
 | ||||
|     if (name->view().is_whitespace()) | ||||
|         return EINVAL; | ||||
|     set_name(move(name)); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A