Changeset b4ad39f in mainline
- Timestamp:
- 2010-04-26T22:23:16Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b8f7ea78
- Parents:
- aeb6f25
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/sysinfo/sysinfo.c
raeb6f25 rb4ad39f 632 632 /** Return sysinfo item determined by name from user space 633 633 * 634 * Should be called with interrupts disabled 635 * and sysinfo_lock held. The path string passed from 636 * the user space has to be properly null-terminated 634 * The path string passed from the user space has to be properly null-terminated 637 635 * (the last passed character must be null). 638 636 * … … 656 654 657 655 if ((copy_from_uspace(path, ptr, size + 1) == 0) 658 && (path[size] == 0)) 656 && (path[size] == 0)) { 657 /* 658 * Prevent other functions from messing with sysinfo while we 659 * are reading it. 660 */ 661 ipl_t ipl = interrupts_disable(); 662 spinlock_lock(&sysinfo_lock); 659 663 ret = sysinfo_get_item(path, NULL, dry_run); 660 664 spinlock_unlock(&sysinfo_lock); 665 interrupts_restore(ipl); 666 } 661 667 free(path); 662 668 return ret; … … 677 683 unative_t sys_sysinfo_get_tag(void *path_ptr, size_t path_size) 678 684 { 679 /* Avoid other functions to mess with sysinfo 680 while we are reading it */ 681 ipl_t ipl = interrupts_disable(); 682 spinlock_lock(&sysinfo_lock); 683 684 /* Get the item. 685 686 N.B.: There is no need to free any potential generated 687 binary data since we request a dry run */ 685 /* 686 * Get the item. 687 * 688 * N.B.: There is no need to free any potential generated 689 * binary data since we request a dry run. 690 */ 688 691 sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true); 689 692 690 /* Map generated value types to constant types 691 (user space does not care whether the 692 value is constant or generated) */ 693 /* 694 * Map generated value types to constant types (user space does not care 695 * whether the value is constant or generated). 696 */ 693 697 if (ret.tag == SYSINFO_VAL_FUNCTION_VAL) 694 698 ret.tag = SYSINFO_VAL_VAL; … … 696 700 ret.tag = SYSINFO_VAL_DATA; 697 701 698 spinlock_unlock(&sysinfo_lock);699 interrupts_restore(ipl);700 701 702 return (unative_t) ret.tag; 702 703 } … … 719 720 void *value_ptr) 720 721 { 721 /* Avoid other functions to mess with sysinfo 722 while we are reading it */ 723 ipl_t ipl = interrupts_disable(); 724 spinlock_lock(&sysinfo_lock); 725 726 /* Get the item. 727 728 N.B.: There is no need to free any potential generated 729 binary data since we request a dry run */ 722 int rc; 723 724 /* 725 * Get the item. 726 * 727 * N.B.: There is no need to free any potential generated binary data 728 * since we request a dry run. 729 */ 730 730 sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true); 731 732 spinlock_unlock(&sysinfo_lock);733 interrupts_restore(ipl);734 735 int rc;736 731 737 732 /* Only constant or generated numerical value is returned */ … … 761 756 void *size_ptr) 762 757 { 763 /* Avoid other functions to mess with sysinfo 764 while we are reading it */ 765 ipl_t ipl = interrupts_disable(); 766 spinlock_lock(&sysinfo_lock); 767 768 /* Get the item. 769 770 N.B.: There is no need to free any potential generated 771 binary data since we request a dry run */ 758 int rc; 759 760 /* 761 * Get the item. 762 * 763 * N.B.: There is no need to free any potential generated binary data 764 * since we request a dry run. 765 */ 772 766 sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true); 773 774 spinlock_unlock(&sysinfo_lock);775 interrupts_restore(ipl);776 777 int rc;778 767 779 768 /* Only the size of constant or generated binary data is considered */ … … 809 798 void *buffer_ptr, size_t buffer_size) 810 799 { 811 /* Avoid other functions to mess with sysinfo 812 while we are reading it */ 813 ipl_t ipl = interrupts_disable(); 814 spinlock_lock(&sysinfo_lock); 800 int rc; 815 801 816 802 /* Get the item */ 817 803 sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, false); 818 804 819 spinlock_unlock(&sysinfo_lock);820 interrupts_restore(ipl);821 822 int rc;823 824 805 /* Only constant or generated binary data is considered */ 825 806 if ((ret.tag == SYSINFO_VAL_DATA) || (ret.tag == SYSINFO_VAL_FUNCTION_DATA)) {
Note:
See TracChangeset
for help on using the changeset viewer.